Sha3 Class
Computes the SHA-3 hash functions SHA3-224, SHA3-256, SHA3-384 and SHA3-512 (FIPS 202).
public static class Sha3Remarks
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
| Name | Description |
|---|---|
| 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.csComputes the SHA-3 digest of data.
public static byte[] HashData(int hashSizeInBits, ReadOnlySpan<byte> source)Parameters
hashSizeInBitsint- The size of the digest, in bits: 224, 256, 384 or 512.
sourceReadOnlySpan<byte>- The data to hash.
Returns
byte[] The digest, of hashSizeInBits / 8 bytes.
Exceptions
ArgumentOutOfRangeExceptionhashSizeInBitsis not 224, 256, 384 or 512.
HashData(int, ReadOnlySpan<byte>, Span<byte>)
Sha3.csComputes the SHA-3 digest of data into a buffer.
Parameters
hashSizeInBitsint- The size of the digest, in bits: 224, 256, 384 or 512.
sourceReadOnlySpan<byte>- The data to hash.
destinationSpan<byte>- The buffer that receives the digest: its length must be
hashSizeInBits/ 8 bytes.
Exceptions
ArgumentOutOfRangeExceptionhashSizeInBitsis not 224, 256, 384 or 512.ArgumentException- The length of
destinationis not the size of the digest.