Key Derivation Function
A key derivation function is a cryptographic algorithm that produces one or more secret keys from an input secret value, such as a master key, a shared secret, or a password. It is used to turn a single starting value into usable keying material for cryptographic operations while helping protect the underlying secret. Different KDFs are designed for different inputs and purposes, so the appropriate choice depends on the use case.
A KDF derives secret keying material from a source of initial keying material (for example, a shared secret established during key agreement, an existing key, or a low-entropy password) together with additional context or salt information. NIST defines it as a function used to derive secret keying material from a shared secret or key and other information. Constructions vary by purpose: HKDF (RFC 5869) is an HMAC-based extract-and-expand KDF intended as a building block where the input already has sufficient entropy, whereas password-based KDFs are designed to add computational cost when deriving keys from low-entropy secrets. Selection, parameters, and inputs (such as salts and context binding) should follow current published guidance and the specific standard governing the deployment; implementers should confirm details against the applicable specification rather than assuming a single KDF fits all scenarios.
Why it matters
Cryptographic systems rarely use a single master secret directly for every operation. Reusing one key across many purposes, or deriving keys in an ad hoc way, can weaken the security guarantees of an otherwise sound design. A key derivation function provides a disciplined way to turn one input secret into distinct, purpose-bound keying material, which helps limit the impact if any single derived key is exposed and helps prevent unintended relationships between keys used for different functions.
The correct KDF depends on the nature of the input. When the input already has sufficient entropy, such as a shared secret established during key agreement, an extract-and-expand construction like HKDF (RFC 5869) is intended to produce well-distributed keying material as a building block within a larger protocol. When the input is a low-entropy secret such as a password, a password-based KDF is designed to add deliberate computational cost, which is intended to make brute-force guessing more expensive. Choosing a general-purpose KDF where a password-hardening function is required, or vice versa, can undermine the protection the system relies on.
Because parameters, salts, and context binding materially affect the outcome, KDF selection and configuration should follow current published guidance and the specific standard governing the deployment. A label alone does not guarantee an appropriate outcome; implementers should confirm details against the applicable specification rather than assuming a single KDF fits every scenario.
Who it's relevant to
Inside KDF
Common questions
Answers to the questions practitioners most commonly ask about KDF.