Sha3 Class

Computes the SHA-3 hash functions SHA3-224, SHA3-256, SHA3-384 and SHA3-512 (FIPS 202).

public static class Sha3

Remarks

The implementation is fully managed: unlike the SHA-3 types of System.Security.Cryptography, it does not depend on the cryptographic library of the operating system, so it is available on every platform (including macOS).

Methods

NameDescription
HashData(int, ReadOnlySpan<byte>)Computes the SHA-3 digest of data.
HashData(int, ReadOnlySpan<byte>, Span<byte>)Computes the SHA-3 digest of data into a buffer.

HashData overloads

HashData(int, ReadOnlySpan<byte>)

Sha3.cs

Computes the SHA-3 digest of data.

public static byte[] HashData(int hashSizeInBits, ReadOnlySpan<byte> source)
Parameters
hashSizeInBits int
The size of the digest, in bits: 224, 256, 384 or 512.
source ReadOnlySpan<byte>
The data to hash.
Returns

byte[] The digest, of hashSizeInBits / 8 bytes.

Exceptions
ArgumentOutOfRangeException
hashSizeInBits is not 224, 256, 384 or 512.

HashData(int, ReadOnlySpan<byte>, Span<byte>)

Sha3.cs

Computes the SHA-3 digest of data into a buffer.

public static void HashData(int hashSizeInBits, ReadOnlySpan<byte> source, Span<byte> destination)
Parameters
hashSizeInBits int
The size of the digest, in bits: 224, 256, 384 or 512.
source ReadOnlySpan<byte>
The data to hash.
destination Span<byte>
The buffer that receives the digest: its length must be hashSizeInBits / 8 bytes.
Exceptions
ArgumentOutOfRangeException
hashSizeInBits is not 224, 256, 384 or 512.
ArgumentException
The length of destination is not the size of the digest.