-
+ B59E346DCF8E4917F1415C6CE23DF63716989B9F8B9182AE767A76900C56F300F75FAFC89E879F06B6DD5C5D5D82C37D9B695A1B6218E527D253892DC3A9CF95
bitcoin/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()