Comment on page
HChaCha20
Fills a span with output keying material derived from high-entropy input keying material, a nonce, and an optional personalization constant for domain separation.
HChaCha20.DeriveKey(Span<byte> outputKeyingMaterial, ReadOnlySpan<byte> inputKeyingMaterial, ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> personalization = default)
outputKeyingMaterial
has a length not equal to OutputSize
.inputKeyingMaterial
has a length not equal to KeySize
.nonce
has a length not equal to NonceSize
.personalization
has a length greater than 0 but not equal to PersonalSize
.These are used for validation and/or save you defining your own constants.
public const int OutputSize = 32;
public const int KeySize = 32;
public const int NonceSize = 16;
public const int PersonalSize = 16;
The input keying material MUST be a uniformly random key, NOT a password, public key, or X25519 shared secret.
Last modified 6mo ago