diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-04-30 20:03:35 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-05-04 06:55:31 +0200 |
commit | fac30eec42c486ec1bfd696293040a7aa0f04625 (patch) | |
tree | 562aadddf3da65e1366d45b2860d8e11c476d866 /src/test/crypto_tests.cpp | |
parent | faece47c4706783e0460ed977390a44630b2d44c (diff) | |
download | bitcoin-fac30eec42c486ec1bfd696293040a7aa0f04625.tar.xz |
refactor: Replace &foo[0] with foo.data()
Diffstat (limited to 'src/test/crypto_tests.cpp')
-rw-r--r-- | src/test/crypto_tests.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index 7358b246b6..edec5f0a31 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -33,7 +33,7 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) { hash.resize(out.size()); { // Test that writing the whole input string at once works. - Hasher(h).Write((unsigned char*)&in[0], in.size()).Finalize(&hash[0]); + Hasher(h).Write((const uint8_t*)in.data(), in.size()).Finalize(hash.data()); BOOST_CHECK(hash == out); } for (int i=0; i<32; i++) { @@ -42,15 +42,15 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) { size_t pos = 0; while (pos < in.size()) { size_t len = InsecureRandRange((in.size() - pos + 1) / 2 + 1); - hasher.Write((unsigned char*)&in[pos], len); + hasher.Write((const uint8_t*)in.data() + pos, len); pos += len; if (pos > 0 && pos + 2 * out.size() > in.size() && pos < in.size()) { // Test that writing the rest at once to a copy of a hasher works. - Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]); + Hasher(hasher).Write((const uint8_t*)in.data() + pos, in.size() - pos).Finalize(hash.data()); BOOST_CHECK(hash == out); } } - hasher.Finalize(&hash[0]); + hasher.Finalize(hash.data()); BOOST_CHECK(hash == out); } } |