util: make EncodeBase58Check consume Spans

This commit is contained in:
Sebastian Falbesoner
2020-08-10 03:03:10 +02:00
parent f0fce0675d
commit 356988e200
3 changed files with 5 additions and 7 deletions

View File

@@ -132,10 +132,10 @@ bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, in
return DecodeBase58(str.c_str(), vchRet, max_ret_len);
}
std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
std::string EncodeBase58Check(Span<const unsigned char> input)
{
// add 4-byte hash check to the end
std::vector<unsigned char> vch(vchIn);
std::vector<unsigned char> vch(input.begin(), input.end());
uint256 hash = Hash(vch);
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
return EncodeBase58(vch);