1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 * Why base-58 instead of standard base-64 encoding?
8 * - Don't want 0OIl characters that look the same in some fonts and
9 * could be used to create visually identical looking data.
10 * - A string with non-alphanumeric characters is not as easily accepted as input.
11 * - E-mail usually won't line-break if there's no punctuation to break at.
12 * - Double-clicking selects the whole string as one word if it's all alphanumeric.
14 #ifndef BITCOIN_BASE58_H
15 #define BITCOIN_BASE58_H
21 * Encode a byte sequence as a base58-encoded string.
22 * pbegin and pend cannot be NULL, unless both are.
24 std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend);
27 * Encode a byte vector as a base58-encoded string
29 std::string EncodeBase58(const std::vector<unsigned char>& vch);
32 * Decode a base58-encoded string (psz) into a byte vector (vchRet).
33 * return true if decoding is successful.
36 bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet);
39 * Decode a base58-encoded string (str) into a byte vector (vchRet).
40 * return true if decoding is successful.
42 bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet);
45 * Encode a byte vector into a base58-encoded string, including checksum
47 std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
50 * Decode a base58-encoded string (psz) that includes a checksum into a byte
51 * vector (vchRet), return true if decoding is successful
53 bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet);
56 * Decode a base58-encoded string (str) that includes a checksum into a byte
57 * vector (vchRet), return true if decoding is successful
59 bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet);
61 #endif // BITCOIN_BASE58_H