MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / DecodeBase58Check

Function DecodeBase58Check

src/base58.cpp:121–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet)
122{
123 if (!DecodeBase58(psz, vchRet) ||
124 (vchRet.size() < 4)) {
125 vchRet.clear();
126 return false;
127 }
128 // re-calculate the checksum, insure it matches the included 4-byte checksum
129 uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4);
130 if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) {
131 vchRet.clear();
132 return false;
133 }
134 vchRet.resize(vchRet.size() - 4);
135 return true;
136}
137
138bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet)
139{

Callers 1

SetStringMethod · 0.85

Calls 7

DecodeBase58Function · 0.85
resizeMethod · 0.80
HashFunction · 0.70
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected