Add project
Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
This commit is contained in:
23
Hcs.Client/GostXades/Helpers/GostHashAlgorithmHelper.cs
Normal file
23
Hcs.Client/GostXades/Helpers/GostHashAlgorithmHelper.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using GostCryptography.Config;
|
||||
using System;
|
||||
|
||||
namespace Hcs.GostXades.Helpers
|
||||
{
|
||||
public static class GostHashAlgorithmHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Рассчитать хэш
|
||||
/// </summary>
|
||||
/// <param name="cryptoProviderType">Тип криптопровайдера</param>
|
||||
/// <param name="bytes"></param>
|
||||
/// <returns></returns>
|
||||
public static string ComputeHash(CryptoProviderTypeEnum cryptoProviderType, byte[] bytes)
|
||||
{
|
||||
byte[] hashValue;
|
||||
GostCryptoConfig.ProviderType = (GostCryptography.Base.ProviderType)cryptoProviderType;
|
||||
var hashAlgorithm = new GostCryptography.Gost_R3411.Gost_R3411_2012_512_HashAlgorithm();
|
||||
hashValue = hashAlgorithm.ComputeHash(bytes);
|
||||
return BitConverter.ToString(hashValue).Replace("-", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user