raw
experimental-genesis    1 //  /****************************\
experimental-genesis 2 // * EXPERIMENTAL BRANCH. *
experimental-genesis 3 // * FOR LABORATORY USE ONLY. *
experimental-genesis 4 // ********************************
experimental-genesis 5 // ************
experimental-genesis 6 // **************
experimental-genesis 7 // ****************
experimental-genesis 8 // **** **** ****
experimental-genesis 9 // *** *** ***
experimental-genesis 10 // *** *** ***
experimental-genesis 11 // *** * * **
experimental-genesis 12 // ******** ********
experimental-genesis 13 // ******* ******
experimental-genesis 14 // *** **
experimental-genesis 15 // * ******* **
experimental-genesis 16 // ** * * * * *
experimental-genesis 17 // ** * * ***
experimental-genesis 18 // **** * * * * ****
experimental-genesis 19 // **** *** * * ** ***
experimental-genesis 20 // **** ********* ******
experimental-genesis 21 // ******* ***** *******
experimental-genesis 22 // ********* ****** **
experimental-genesis 23 // ** ****** ******
experimental-genesis 24 // ** ******* **
experimental-genesis 25 // ** ******* ***
experimental-genesis 26 // **** ******** ************
experimental-genesis 27 // ************ ************
experimental-genesis 28 // ******** *******
experimental-genesis 29 // ****** ****
experimental-genesis 30 // *** ***
experimental-genesis 31 // ********************************
experimental-genesis 32 #include <boost/test/unit_test.hpp>
experimental-genesis 33
experimental-genesis 34 #include "../uint256.h"
experimental-genesis 35
experimental-genesis 36 extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
experimental-genesis 37
experimental-genesis 38 BOOST_AUTO_TEST_SUITE(miner_tests)
experimental-genesis 39
experimental-genesis 40 BOOST_AUTO_TEST_CASE(sha256transform_equality)
experimental-genesis 41 {
experimental-genesis 42 unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
experimental-genesis 43
experimental-genesis 44
experimental-genesis 45 unsigned char pstate[32];
experimental-genesis 46 unsigned char pinput[64];
experimental-genesis 47
experimental-genesis 48 int i;
experimental-genesis 49
experimental-genesis 50 for (i = 0; i < 32; i++) {
experimental-genesis 51 pinput[i] = i;
experimental-genesis 52 pinput[i+32] = 0;
experimental-genesis 53 }
experimental-genesis 54
experimental-genesis 55 uint256 hash;
experimental-genesis 56
experimental-genesis 57 SHA256Transform(&hash, pinput, pSHA256InitState);
experimental-genesis 58
experimental-genesis 59 BOOST_TEST_MESSAGE(hash.GetHex());
experimental-genesis 60
experimental-genesis 61 uint256 hash_reference("0x2df5e1c65ef9f8cde240d23cae2ec036d31a15ec64bc68f64be242b1da6631f3");
experimental-genesis 62
experimental-genesis 63 BOOST_CHECK(hash == hash_reference);
experimental-genesis 64 }
experimental-genesis 65
experimental-genesis 66 BOOST_AUTO_TEST_SUITE_END()