Changeset View
Changeset View
Standalone View
Standalone View
src/base58.h
Show All 10 Lines | |||||
* input. | * input. | ||||
* - E-mail usually won't line-break if there's no punctuation to break at. | * - E-mail usually won't line-break if there's no punctuation to break at. | ||||
* - Double-clicking selects the whole string as one word if it's all | * - Double-clicking selects the whole string as one word if it's all | ||||
* alphanumeric. | * alphanumeric. | ||||
*/ | */ | ||||
#ifndef BITCOIN_BASE58_H | #ifndef BITCOIN_BASE58_H | ||||
#define BITCOIN_BASE58_H | #define BITCOIN_BASE58_H | ||||
#include <chainparams.h> | |||||
#include <key.h> | |||||
#include <pubkey.h> | |||||
#include <script/standard.h> | |||||
#include <support/allocators/zeroafterfree.h> | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
/** | /** | ||||
* Encode a byte sequence as a base58-encoded string. | * Encode a byte sequence as a base58-encoded string. | ||||
* pbegin and pend cannot be nullptr, unless both are. | * pbegin and pend cannot be nullptr, unless both are. | ||||
*/ | */ | ||||
std::string EncodeBase58(const uint8_t *pbegin, const uint8_t *pend); | std::string EncodeBase58(const uint8_t *pbegin, const uint8_t *pend); | ||||
Show All 20 Lines | |||||
* Encode a byte vector into a base58-encoded string, including checksum | * Encode a byte vector into a base58-encoded string, including checksum | ||||
*/ | */ | ||||
std::string EncodeBase58Check(const std::vector<uint8_t> &vchIn); | std::string EncodeBase58Check(const std::vector<uint8_t> &vchIn); | ||||
/** | /** | ||||
* Decode a base58-encoded string (psz) that includes a checksum into a byte | * Decode a base58-encoded string (psz) that includes a checksum into a byte | ||||
* vector (vchRet), return true if decoding is successful | * vector (vchRet), return true if decoding is successful | ||||
*/ | */ | ||||
inline bool DecodeBase58Check(const char *psz, std::vector<uint8_t> &vchRet); | bool DecodeBase58Check(const char *psz, std::vector<uint8_t> &vchRet); | ||||
/** | /** | ||||
* Decode a base58-encoded string (str) that includes a checksum into a byte | * Decode a base58-encoded string (str) that includes a checksum into a byte | ||||
* vector (vchRet), return true if decoding is successful | * vector (vchRet), return true if decoding is successful | ||||
*/ | */ | ||||
inline bool DecodeBase58Check(const std::string &str, | bool DecodeBase58Check(const std::string &str, std::vector<uint8_t> &vchRet); | ||||
std::vector<uint8_t> &vchRet); | |||||
CKey DecodeSecret(const std::string &str); | |||||
std::string EncodeSecret(const CKey &key); | |||||
CExtKey DecodeExtKey(const std::string &str); | |||||
std::string EncodeExtKey(const CExtKey &extkey); | |||||
CExtPubKey DecodeExtPubKey(const std::string &str); | |||||
std::string EncodeExtPubKey(const CExtPubKey &extpubkey); | |||||
std::string EncodeLegacyAddr(const CTxDestination &dest, const CChainParams &); | |||||
CTxDestination DecodeLegacyAddr(const std::string &str, | |||||
const CChainParams ¶ms); | |||||
#endif // BITCOIN_BASE58_H | #endif // BITCOIN_BASE58_H |