Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
24 lines
873 B
C#
24 lines
873 B
C#
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("-", "");
|
|
}
|
|
}
|
|
}
|