aboutsummaryrefslogtreecommitdiff
path: root/src/test/key_tests.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-06-26 13:36:41 -0700
committerPieter Wuille <pieter@wuille.net>2020-07-30 13:57:54 -0700
commit77c507358bda9bd6c496f33e0f4418c0603bb08d (patch)
tree53e59bb680078392dbc32315c0b0f2adcde882f9 /src/test/key_tests.cpp
parent02c4cc5c5ddf61f98ee366a4bea8abc26de492bd (diff)
downloadbitcoin-77c507358bda9bd6c496f33e0f4418c0603bb08d.tar.xz
Make Hash[160] consume range-like objects
Diffstat (limited to 'src/test/key_tests.cpp')
-rw-r--r--src/test/key_tests.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp
index 44e2f1c41e..4e4c44266a 100644
--- a/src/test/key_tests.cpp
+++ b/src/test/key_tests.cpp
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(key_test1)
for (int n=0; n<16; n++)
{
std::string strMsg = strprintf("Very secret message %i: 11", n);
- uint256 hashMsg = Hash(strMsg.begin(), strMsg.end());
+ uint256 hashMsg = Hash(strMsg);
// normal signatures
@@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(key_test1)
std::vector<unsigned char> detsig, detsigc;
std::string strMsg = "Very deterministic message";
- uint256 hashMsg = Hash(strMsg.begin(), strMsg.end());
+ uint256 hashMsg = Hash(strMsg);
BOOST_CHECK(key1.Sign(hashMsg, detsig));
BOOST_CHECK(key1C.Sign(hashMsg, detsigc));
BOOST_CHECK(detsig == detsigc);
@@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(key_signature_tests)
// When entropy is specified, we should see at least one high R signature within 20 signatures
CKey key = DecodeSecret(strSecret1);
std::string msg = "A message to be signed";
- uint256 msg_hash = Hash(msg.begin(), msg.end());
+ uint256 msg_hash = Hash(msg);
std::vector<unsigned char> sig;
bool found = false;
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(key_signature_tests)
for (int i = 0; i < 256; ++i) {
sig.clear();
std::string msg = "A message to be signed" + ToString(i);
- msg_hash = Hash(msg.begin(), msg.end());
+ msg_hash = Hash(msg);
BOOST_CHECK(key.Sign(msg_hash, sig));
found = sig[3] == 0x20;
BOOST_CHECK(sig.size() <= 70);