KangarooTwelve Class
Computes the extendable-output functions KT128 and KT256 (KangarooTwelve, RFC 9861).
public static class KangarooTwelveRemarks
KangarooTwelve is a tree hash over TurboSHAKE: the data is split in chunks of 8 KiB, whose hashes are combined.
Methods
| Name | Description |
|---|---|
| HashData(int, ReadOnlySpan<byte>, int, ReadOnlySpan<byte>) | Computes the output of KangarooTwelve for data. |
| HashData(int, ReadOnlySpan<byte>, Span<byte>, ReadOnlySpan<byte>) | Computes the output of KangarooTwelve for data into a buffer. |
HashData overloads
HashData(int, ReadOnlySpan<byte>, int, ReadOnlySpan<byte>)
KangarooTwelve.csComputes the output of KangarooTwelve for data.
public static byte[] HashData(int securityStrength, ReadOnlySpan<byte> source, int outputLength, ReadOnlySpan<byte> customization = default)Parameters
securityStrengthint- The security strength, in bits: 128 (KT128) or 256 (KT256).
sourceReadOnlySpan<byte>- The data to hash.
outputLengthint- The length of the output, in bytes.
customizationReadOnlySpan<byte>- The customization string C.
Returns
byte[] The output, of outputLength bytes.
Exceptions
ArgumentOutOfRangeExceptionsecurityStrengthis not 128 or 256, oroutputLengthis negative.
HashData(int, ReadOnlySpan<byte>, Span<byte>, ReadOnlySpan<byte>)
KangarooTwelve.csComputes the output of KangarooTwelve for data into a buffer.
public static void HashData(int securityStrength, ReadOnlySpan<byte> source, Span<byte> destination, ReadOnlySpan<byte> customization = default)Parameters
securityStrengthint- The security strength, in bits: 128 (KT128) or 256 (KT256).
sourceReadOnlySpan<byte>- The data to hash.
destinationSpan<byte>- The buffer to fill with the output.
customizationReadOnlySpan<byte>- The customization string C.
Exceptions
ArgumentOutOfRangeExceptionsecurityStrengthis not 128 or 256.