mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Specialized double sha256 for 64 byte inputs
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user