Projects : bitcoin : bitcoin_dumpblock_no_losers
1 | #include <boost/test/unit_test.hpp> |
2 | |
3 | #include "../uint256.h" |
4 | |
5 | extern void SHA256Transform(void* pstate, void* pinput, const void* pinit); |
6 | |
7 | BOOST_AUTO_TEST_SUITE(miner_tests) |
8 | |
9 | BOOST_AUTO_TEST_CASE(sha256transform_equality) |
10 | { |
11 | unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; |
12 | |
13 | |
14 | unsigned char pstate[32]; |
15 | unsigned char pinput[64]; |
16 | |
17 | int i; |
18 | |
19 | for (i = 0; i < 32; i++) { |
20 | pinput[i] = i; |
21 | pinput[i+32] = 0; |
22 | } |
23 | |
24 | uint256 hash; |
25 | |
26 | SHA256Transform(&hash, pinput, pSHA256InitState); |
27 | |
28 | BOOST_TEST_MESSAGE(hash.GetHex()); |
29 | |
30 | uint256 hash_reference("0x2df5e1c65ef9f8cde240d23cae2ec036d31a15ec64bc68f64be242b1da6631f3"); |
31 | |
32 | BOOST_CHECK(hash == hash_reference); |
33 | } |
34 | |
35 | BOOST_AUTO_TEST_SUITE_END() |