Make Hash[160] consume range-like objects
This commit is contained in:
1 parent
02c4cc5c5d
commit
77c507358b
16 files changed
+40
-63
No files matched your search
+2
-2
@@ -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