Interface IExtendableOutput
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Hash
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Defines support for extendable-output function (XOF) mode, allowing variable-length output from a hash algorithm.
public interface IExtendableOutput
Remarks
An XOF produces an arbitrary number of output bytes. After absorbing all input, the caller squeezes as many bytes as needed, possibly in multiple calls.
Algorithms that implement this interface include SHAKE128/256, TurboSHAKE128/256, cSHAKE128/256, KT128/256, KMAC128/256, BLAKE3, and Ascon-XOF128.
Methods
Absorb(ReadOnlySpan<byte>)
Absorbs input data into the XOF state.
void Absorb(ReadOnlySpan<byte> input)
Parameters
inputReadOnlySpan<byte>The input data to absorb.
Exceptions
- InvalidOperationException
Thrown when data is added after output has been squeezed.
Reset()
Resets the XOF state so the instance can be reused for a new computation.
void Reset()
Remarks
After calling this method, the instance is in the same state as a newly constructed one. All previously absorbed data and squeezed output are discarded.
Squeeze(Span<byte>)
Squeezes output bytes from the XOF state.
void Squeeze(Span<byte> output)
Parameters
Remarks
After the first call, the hash is finalized and no more data can be absorbed. May be called multiple times for streaming output.