diff --git a/src/server/shared/Crypto.cpp b/src/server/shared/Crypto.cpp index 841a17f..08dea8e 100644 --- a/src/server/shared/Crypto.cpp +++ b/src/server/shared/Crypto.cpp @@ -5,10 +5,14 @@ namespace Crypto { 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_256 (hash1, 64, hash2); std::vector hash(32); - i2p::crypto::GOSTR3411_2012_256 (hash1, 64, &hash[0]); - return std::vector(hash.begin(), hash.end()); + // To Little Endian. TODO implement faster + for (int i = 0; i < 32; i++) + hash[i] = hash2[31-i]; + + return hash; } }