<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />

Gost3411_2012_256Digest

using Org.BouncyCastle.Utilities; using System; namespace Org.BouncyCastle.Crypto.Digests { public class Gost3411_2012_256Digest : Gost3411_2012Digest { private static readonly byte[] IV = new byte[64] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; public override string AlgorithmName => "GOST3411-2012-256"; public Gost3411_2012_256Digest() : base(IV) { } public Gost3411_2012_256Digest(Gost3411_2012_256Digest other) : base(IV) { Reset(other); } public override int GetDigestSize() { return 32; } public override int DoFinal(byte[] output, int outOff) { byte[] array = new byte[64]; base.DoFinal(array, 0); Array.Copy(array, 32, output, outOff, 32); return 32; } public unsafe override int DoFinal(Span<byte> output) { Span<byte> output2 = new Span<byte>(stackalloc byte[64], 64); base.DoFinal(output2); output2.Slice(32, output2.Length - 32).CopyTo(output); return 32; } public override IMemoable Copy() { return new Gost3411_2012_256Digest(this); } } }