1
0
mirror of https://github.com/GOSTSec/poolserver synced 2025-01-14 08:47:53 +00:00

GOSTD implemntation

This commit is contained in:
orignal 2017-05-05 13:45:43 -04:00
parent b140e8da98
commit f3f7ac9cda
4 changed files with 1094 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include "Crypto.h"
#include "Gost.h"
namespace Crypto
{
@ -22,4 +23,13 @@ namespace Crypto
{
return SHA256(SHA256(data));
}
BinaryData GOSTD(BinaryData data)
{
uint8_t hash1[64];
i2p::crypto::GOSTR3411_2012_512 (&data[0], data.size (), hash1);
std::vector<byte> hash;
i2p::crypto::GOSTR3411_2012_256 (hash1, 64, &hash[0]);
return std::vector<byte>(hash.begin(), hash.end());
}
}

View File

@ -12,6 +12,8 @@ namespace Crypto
BinaryData SHA256(BinaryData data);
BinaryData SHA256(std::string data);
BinaryData SHA256D(BinaryData data);
BinaryData GOSTD(BinaryData data);
}
#endif

1058
src/server/shared/Gost.cpp Normal file

File diff suppressed because it is too large Load Diff

24
src/server/shared/Gost.h Normal file
View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2013-2017, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
*/
#ifndef GOST_H__
#define GOST_H__
#include <inttypes.h>
namespace i2p
{
namespace crypto
{
// Big Endian
void GOSTR3411_2012_256 (const uint8_t * buf, size_t len, uint8_t * digest);
void GOSTR3411_2012_512 (const uint8_t * buf, size_t len, uint8_t * digest);
}
}
#endif