You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

miner_tests.cpp 805B

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