-
+ 2A9EF7188884C3709442DF17B980E688E5CAC6ECC456A093710B20C238C115238BCD243D8BE5E7684978B1BFB287E6CAD84688180DB6A4BB432DBA449E471420bitcoin/src/test/miner_tests.cpp(0 . 0)(1 . 35)
21348 #include <boost/test/unit_test.hpp>
21349
21350 #include "../uint256.h"
21351
21352 extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
21353
21354 BOOST_AUTO_TEST_SUITE(miner_tests)
21355
21356 BOOST_AUTO_TEST_CASE(sha256transform_equality)
21357 {
21358 unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
21359
21360
21361 unsigned char pstate[32];
21362 unsigned char pinput[64];
21363
21364 int i;
21365
21366 for (i = 0; i < 32; i++) {
21367 pinput[i] = i;
21368 pinput[i+32] = 0;
21369 }
21370
21371 uint256 hash;
21372
21373 SHA256Transform(&hash, pinput, pSHA256InitState);
21374
21375 BOOST_TEST_MESSAGE(hash.GetHex());
21376
21377 uint256 hash_reference("0x2df5e1c65ef9f8cde240d23cae2ec036d31a15ec64bc68f64be242b1da6631f3");
21378
21379 BOOST_CHECK(hash == hash_reference);
21380 }
21381
21382 BOOST_AUTO_TEST_SUITE_END()