diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-09-26 18:29:42 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-05-29 14:05:00 -0700 |
commit | d0c96328833127284574bfef26f96aa2e4afc91a (patch) | |
tree | 8eb834544a3b6611ce5de339f9b0fc2974536189 /src/test/crypto_tests.cpp | |
parent | 57f34630fb6c3e218bd19535ac607008cb894173 (diff) |
Specialized double sha256 for 64 byte inputs
Diffstat (limited to 'src/test/crypto_tests.cpp')
-rw-r--r-- | src/test/crypto_tests.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index 518cb849bb..d701f3bc4e 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -546,4 +546,20 @@ BOOST_AUTO_TEST_CASE(countbits_tests) } } +BOOST_AUTO_TEST_CASE(sha256d64) +{ + for (int i = 0; i <= 32; ++i) { + unsigned char in[64 * 32]; + unsigned char out1[32 * 32], out2[32 * 32]; + for (int j = 0; j < 64 * i; ++j) { + in[j] = InsecureRandBits(8); + } + for (int j = 0; j < i; ++j) { + CHash256().Write(in + 64 * j, 64).Finalize(out1 + 32 * j); + } + SHA256D64(out2, in, i); + BOOST_CHECK(memcmp(out1, out2, 32 * i) == 0); + } +} + BOOST_AUTO_TEST_SUITE_END() |