sha256 implementation – Bitcoin Stack Exchange

Hi I’m trying to use bitcoind’s vectorized SHA256 implementation in src/crytpo/sha256_*.cpp in my project. On a first try feeding a block of 64 null bytes to SHA256D64 I obtain the hash {0xe2, 0xf6, 0x1c, 0x3f, 0x71, 0xd1, 0xde, 0xfd, 0x3f, 0xa9, 0x99, 0xdf, 0xa3, 0x69, 0x53, 0x75, 0x5c, 0x69, 0x6, 0x89, 0x79, 0x99, 0x62, 0xb4, 0x8b, 0xeb, 0xd8, 0x36, 0x97, 0x4e, 0x8c, 0xf9} which does not agree with openssl’s output of f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b. Also the testvectors TestSHA256 in src/test/crypto_test.cpp have different outcome on openssl. For example “message digest” will give f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 in that testvector, but openssl gives 3520b54ccec750d15256ada5b3d51cfddcec7fad1482f6bde2ea1c31a2c5b3a5. So I’m wondering what’s the implementation difference?