diff --git a/src/hash.h b/src/hash.h index 536ab71..02e5fca 100644 --- a/src/hash.h +++ b/src/hash.h @@ -7,6 +7,7 @@ #include "uint256.h" #include "serialize.h" +#include "Gost.h" #include #include @@ -15,11 +16,12 @@ template inline uint256 Hash(const T1 pbegin, const T1 pend) { + // GOST 34.11-256 (GOST 34.11-512 (...)) static unsigned char pblank[1]; - uint256 hash1; - SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1); + uint8_t hash1[64]; + i2p::crypto::GOSTR3411_2012_512 ((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), hash1); uint256 hash2; - SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + i2p::crypto::GOSTR3411_2012_256 ((unsigned char*)&hash1, 61, hash2.begin ()); return hash2; } diff --git a/src/main.h b/src/main.h index 6d4af7d..a5ba4bb 100644 --- a/src/main.h +++ b/src/main.h @@ -1362,12 +1362,7 @@ public: uint256 GetPoWHash() const { - // GOST 34.11-256 (GOST 34.11-512 (header)) - uint8_t digest[64]; - i2p::crypto::GOSTR3411_2012_512 ((const uint8_t *)&nVersion, 80, digest); - uint256 thash; - i2p::crypto::GOSTR3411_2012_256 (digest, 64, thash.begin ()); - return thash; + return GetHash (); } CBlockHeader GetBlockHeader() const