#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) #pragma warning disable using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests { /** * Draft FIPS 180-2 implementation of SHA-512. Note: As this is * based on a draft this implementation is subject to change. * *
* block word digest
* SHA-1 512 32 160
* SHA-256 512 32 256
* SHA-384 1024 64 384
* SHA-512 1024 64 512
*
*/
public class Sha512Digest
: LongDigest
{
private const int DigestLength = 64;
public Sha512Digest()
{
}
/**
* Copy constructor. This will copy the state of the provided
* message digest.
*/
public Sha512Digest(
Sha512Digest t)
: base(t)
{
}
public override string AlgorithmName
{
get { return "SHA-512"; }
}
public override int GetDigestSize()
{
return DigestLength;
}
public override int DoFinal(
byte[] output,
int outOff)
{
Finish();
Pack.UInt64_To_BE(H1, output, outOff);
Pack.UInt64_To_BE(H2, output, outOff + 8);
Pack.UInt64_To_BE(H3, output, outOff + 16);
Pack.UInt64_To_BE(H4, output, outOff + 24);
Pack.UInt64_To_BE(H5, output, outOff + 32);
Pack.UInt64_To_BE(H6, output, outOff + 40);
Pack.UInt64_To_BE(H7, output, outOff + 48);
Pack.UInt64_To_BE(H8, output, outOff + 56);
Reset();
return DigestLength;
}
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || _UNITY_2021_2_OR_NEWER_
public override int DoFinal(Span