mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Make Hash[160] consume range-like objects
This commit is contained in:
@@ -141,7 +141,7 @@ std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
|
||||
{
|
||||
// add 4-byte hash check to the end
|
||||
std::vector<unsigned char> vch(vchIn);
|
||||
uint256 hash = Hash(vch.begin(), vch.end());
|
||||
uint256 hash = Hash(vch);
|
||||
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
|
||||
return EncodeBase58(vch);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, int
|
||||
return false;
|
||||
}
|
||||
// re-calculate the checksum, ensure it matches the included 4-byte checksum
|
||||
uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4);
|
||||
uint256 hash = Hash(MakeSpan(vchRet).first(vchRet.size() - 4));
|
||||
if (memcmp(&hash, &vchRet[vchRet.size() - 4], 4) != 0) {
|
||||
vchRet.clear();
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user