]> Git Repo - VerusCoin.git/blame - src/base58.h
Auto merge of #3242 - str4d:3058-key-encoding-refactor, r=str4d
[VerusCoin.git] / src / base58.h
CommitLineData
0a61b0df 1// Copyright (c) 2009-2010 Satoshi Nakamoto
f914f1a7 2// Copyright (c) 2009-2014 The Bitcoin Core developers
fa94b9d5 3// Distributed under the MIT software license, see the accompanying
3a25a2b9 4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
0a61b0df 5
fa94b9d5
MF
6/**
7 * Why base-58 instead of standard base-64 encoding?
8 * - Don't want 0OIl characters that look the same in some fonts and
b05a89b2
LD
9 * could be used to create visually identical looking data.
10 * - A string with non-alphanumeric characters is not as easily accepted as input.
fa94b9d5 11 * - E-mail usually won't line-break if there's no punctuation to break at.
b05a89b2 12 * - Double-clicking selects the whole string as one word if it's all alphanumeric.
fa94b9d5 13 */
223b6f1b
WL
14#ifndef BITCOIN_BASE58_H
15#define BITCOIN_BASE58_H
0a61b0df 16
51ed9ec9
BD
17#include <string>
18#include <vector>
19
4e9667b8 20/**
b58be132
PW
21 * Encode a byte sequence as a base58-encoded string.
22 * pbegin and pend cannot be NULL, unless both are.
4e9667b8 23 */
b58be132 24std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend);
0a61b0df 25
4e9667b8 26/**
27 * Encode a byte vector as a base58-encoded string
28 */
f6b7c644 29std::string EncodeBase58(const std::vector<unsigned char>& vch);
0a61b0df 30
4e9667b8 31/**
b58be132
PW
32 * Decode a base58-encoded string (psz) into a byte vector (vchRet).
33 * return true if decoding is successful.
34 * psz cannot be NULL.
4e9667b8 35 */
b58be132 36bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet);
0a61b0df 37
4e9667b8 38/**
b58be132
PW
39 * Decode a base58-encoded string (str) into a byte vector (vchRet).
40 * return true if decoding is successful.
4e9667b8 41 */
f6b7c644 42bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet);
0a61b0df 43
4e9667b8 44/**
45 * Encode a byte vector into a base58-encoded string, including checksum
46 */
f6b7c644 47std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
0a61b0df 48
4e9667b8 49/**
50 * Decode a base58-encoded string (psz) that includes a checksum into a byte
51 * vector (vchRet), return true if decoding is successful
52 */
3d31e09c 53bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet);
0a61b0df 54
4e9667b8 55/**
56 * Decode a base58-encoded string (str) that includes a checksum into a byte
57 * vector (vchRet), return true if decoding is successful
58 */
3d31e09c 59bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet);
472f75bc 60
d0b0925b 61#endif // BITCOIN_BASE58_H
This page took 0.17877 seconds and 4 git commands to generate.