mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
util: remove c-string interfaces for DecodeBase58{Check}
This commit is contained in:
parent
ffad348167
commit
d3e8adfada
@ -35,7 +35,7 @@ static const int8_t mapBase58[256] = {
|
||||
-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
|
||||
};
|
||||
|
||||
bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch, int max_ret_len)
|
||||
NODISCARD static bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch, int max_ret_len)
|
||||
{
|
||||
// Skip leading spaces.
|
||||
while (*psz && IsSpace(*psz))
|
||||
@ -146,7 +146,7 @@ std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
|
||||
return EncodeBase58(vch);
|
||||
}
|
||||
|
||||
bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len)
|
||||
NODISCARD static bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len)
|
||||
{
|
||||
if (!DecodeBase58(psz, vchRet, max_ret_len > std::numeric_limits<int>::max() - 4 ? std::numeric_limits<int>::max() : max_ret_len + 4) ||
|
||||
(vchRet.size() < 4)) {
|
||||
|
13
src/base58.h
13
src/base58.h
@ -30,13 +30,6 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
|
||||
*/
|
||||
std::string EncodeBase58(const std::vector<unsigned char>& vch);
|
||||
|
||||
/**
|
||||
* Decode a base58-encoded string (psz) into a byte vector (vchRet).
|
||||
* return true if decoding is successful.
|
||||
* psz cannot be nullptr.
|
||||
*/
|
||||
NODISCARD bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len);
|
||||
|
||||
/**
|
||||
* Decode a base58-encoded string (str) into a byte vector (vchRet).
|
||||
* return true if decoding is successful.
|
||||
@ -48,12 +41,6 @@ NODISCARD bool DecodeBase58(const std::string& str, std::vector<unsigned char>&
|
||||
*/
|
||||
std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
|
||||
|
||||
/**
|
||||
* Decode a base58-encoded string (psz) that includes a checksum into a byte
|
||||
* vector (vchRet), return true if decoding is successful
|
||||
*/
|
||||
NODISCARD bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len);
|
||||
|
||||
/**
|
||||
* Decode a base58-encoded string (str) that includes a checksum into a byte
|
||||
* vector (vchRet), return true if decoding is successful
|
||||
|
Loading…
Reference in New Issue
Block a user