|
|
@ -5,10 +5,14 @@ namespace Crypto |
|
|
|
{ |
|
|
|
{ |
|
|
|
BinaryData GOSTD(BinaryData data) |
|
|
|
BinaryData GOSTD(BinaryData data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint8_t hash1[64]; |
|
|
|
uint8_t hash1[64], hash2[32]; |
|
|
|
i2p::crypto::GOSTR3411_2012_512 (&data[0], data.size (), hash1); |
|
|
|
i2p::crypto::GOSTR3411_2012_512 (&data[0], data.size (), hash1); |
|
|
|
|
|
|
|
i2p::crypto::GOSTR3411_2012_256 (hash1, 64, hash2); |
|
|
|
std::vector<byte> hash(32); |
|
|
|
std::vector<byte> hash(32); |
|
|
|
i2p::crypto::GOSTR3411_2012_256 (hash1, 64, &hash[0]); |
|
|
|
// To Little Endian. TODO implement faster
|
|
|
|
return std::vector<byte>(hash.begin(), hash.end()); |
|
|
|
for (int i = 0; i < 32; i++) |
|
|
|
|
|
|
|
hash[i] = hash2[31-i]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return hash; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|