TurboShake Class
Computes the extendable-output functions TurboSHAKE128 and TurboSHAKE256 (RFC 9861).
public static class TurboShakeRemarks
TurboSHAKE is the sponge of SHAKE with 12 rounds of the permutation instead of 24, which makes it about twice as fast.
Methods
| Name | Description |
|---|---|
| HashData(int, ReadOnlySpan<byte>, int, byte) | Computes the output of TurboSHAKE for data. |
| HashData(int, ReadOnlySpan<byte>, Span<byte>, byte) | Computes the output of TurboSHAKE for data into a buffer. |
HashData overloads
HashData(int, ReadOnlySpan<byte>, int, byte)
TurboShake.csComputes the output of TurboSHAKE for data.
public static byte[] HashData(int securityStrength, ReadOnlySpan<byte> source, int outputLength, byte domainSeparation = 31)Parameters
securityStrengthint- The security strength, in bits: 128 (TurboSHAKE128) or 256 (TurboSHAKE256).
sourceReadOnlySpan<byte>- The data to hash.
outputLengthint- The length of the output, in bytes.
domainSeparationbyte- The domain separation byte D, in the range 0x01 to 0x7F.
Returns
byte[] The output, of outputLength bytes.
Exceptions
ArgumentOutOfRangeExceptionsecurityStrengthis not 128 or 256,outputLengthis negative, ordomainSeparationis not in the range 0x01 to 0x7F.
HashData(int, ReadOnlySpan<byte>, Span<byte>, byte)
TurboShake.csComputes the output of TurboSHAKE for data into a buffer.
public static void HashData(int securityStrength, ReadOnlySpan<byte> source, Span<byte> destination, byte domainSeparation = 31)Parameters
securityStrengthint- The security strength, in bits: 128 (TurboSHAKE128) or 256 (TurboSHAKE256).
sourceReadOnlySpan<byte>- The data to hash.
destinationSpan<byte>- The buffer to fill with the output.
domainSeparationbyte- The domain separation byte D, in the range 0x01 to 0x7F.
Exceptions
ArgumentOutOfRangeExceptionsecurityStrengthis not 128 or 256, ordomainSeparationis not in the range 0x01 to 0x7F.
Constants
| Name | Description |
|---|---|
| DefaultDomainSeparation | The default domain separation byte D. |
DefaultDomainSeparation
The default domain separation byte D.
public const byte DefaultDomainSeparation = 31