pub fn hchacha20(key: &[u8; 32], input: &[u8; 16]) -> [u8; 32]Expand description
HChaCha20 is a hash function derived from ChaCha20.
It takes a 256-bit key and a 128-bit input (nonce) and produces a 256-bit hash. It is used internally by XChaCha20 to derive a subkey.
ยงAlgorithm
- Initialize a ChaCha20 state with the constant, key, and 128-bit nonce (placed in the counter and nonce positions).
- Perform 20 rounds (10 double rounds) of ChaCha quarter rounds.
- Output words 0-3 and 12-15 of the final state, serialized as little-endian bytes (without adding the initial state back).