mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-03-12 13:21:21 +00:00
double GOST 34.11 for block hash
This commit is contained in:
parent
3753bb3410
commit
9528b4e972
@ -7,6 +7,7 @@
|
||||
|
||||
#include "uint256.h"
|
||||
#include "serialize.h"
|
||||
#include "Gost.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ripemd.h>
|
||||
@ -15,11 +16,12 @@
|
||||
template<typename T1>
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user