A key derivation function (KDF) turns one secret into one or more cryptographic keys or pseudorandom values. Unlike a PRNG, it can accept a biased secret with enough entropy, such as key-exchange output, and produce uniformly random secrets. KDFs are deterministic, helping participants rederive the same limited set of keys. section 8.6 section 8.9
HKDF, the most widely used KDF, separates derivation into two steps:
- HKDF-Extract removes bias from an input secret and produces a uniformly random secret. An optional salt is used as the HMAC key, and different salts produce different outputs. section 8.6
- HKDF-Expand uses a uniformly random secret to produce output of a requested length. An optional info value separates outputs: different info values with the same secret produce different results. section 8.6
- Implementations commonly expose Extract and Expand together as one HKDF call. HKDF is built on HMAC and is defined in RFC 5869; SHA-2 is commonly used. section 8.6
