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

Blake2sDigest

public sealed class Blake2sDigest : IDigest
Implementation of the cryptographic hash function BLAKE2s. BLAKE2s is optimized for 32-bit platforms and produces digests of any size between 1 and 32 bytes.
public string AlgorithmName { get; }

public Blake2sDigest()

Initializes a new instance of Blake2sDigest.

Constructs a new instance of Blake2sDigest from another Blake2sDigest./>.

public Blake2sDigest(int digestBits)

Initializes a new instance of Blake2sDigest with a given digest size.

public Blake2sDigest(byte[] key)

Initializes a new instance of Blake2sDigest with a key.

Blake2s for authentication ("Prefix-MAC mode"). After calling the DoFinal method, the key will remain to be used for further computations of this instance. The key can be cleared using the ClearKey method.

public Blake2sDigest(byte[] key, int digestBytes, byte[] salt, byte[] personalization)

Initializes a new instance of Blake2sDigest with a key, required digest length (in bytes), salt and personalization.

After calling the DoFinal method, the key, the salt and the personalization will remain and might be used for further computations with this instance. The key can be overwritten using the ClearKey method, the salt (pepper) can be overwritten using the ClearSalt method.

public void BlockUpdate(byte[] message, int offset, int len)

public void BlockUpdate(ReadOnlySpan<byte> input)

public void ClearKey()

Clears the key.

public void ClearSalt()

Clears the salt (pepper).

public int DoFinal(byte[] output, int outOffset)

Close the digest, producing the final digest value.

public int DoFinal(Span<byte> output)

Close the digest, producing the final digest value.

public int GetByteLength()

Return the size in bytes of the internal buffer the digest applies it's compression function to.

public int GetDigestSize()

public void Reset()

Reset the digest back to it's initial state. The key, the salt and the personalization will remain for further computations.

public void Update(byte b)