aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base58.cpp4
-rw-r--r--src/base58.h4
-rw-r--r--src/bench/base58.cpp4
3 files changed, 5 insertions, 7 deletions
diff --git a/src/base58.cpp b/src/base58.cpp
index 715e4e7891..18cd2090e0 100644
--- a/src/base58.cpp
+++ b/src/base58.cpp
@@ -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);
diff --git a/src/base58.h b/src/base58.h
index d9791d1dbe..b87664b78b 100644
--- a/src/base58.h
+++ b/src/base58.h
@@ -39,9 +39,9 @@ NODISCARD bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet,
NODISCARD bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len);
/**
- * Encode a byte vector into a base58-encoded string, including checksum
+ * Encode a byte span into a base58-encoded string, including checksum
*/
-std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
+std::string EncodeBase58Check(Span<const unsigned char> input);
/**
* Decode a base58-encoded string (psz) that includes a checksum into a byte
diff --git a/src/bench/base58.cpp b/src/bench/base58.cpp
index dee3ffeb6b..18cb5de196 100644
--- a/src/bench/base58.cpp
+++ b/src/bench/base58.cpp
@@ -34,10 +34,8 @@ static void Base58CheckEncode(benchmark::Bench& bench)
200, 24
}
};
- std::vector<unsigned char> vch;
- vch.assign(buff.begin(), buff.end());
bench.batch(buff.size()).unit("byte").run([&] {
- EncodeBase58Check(vch);
+ EncodeBase58Check(buff);
});
}