Key Derivation Function
Subject: Computer and Technology noun /kiː ˌdɛr.ɪˈveɪ.ʃən ˈfʌŋk.ʃən/ 1 definition
- applied-cryptography
- key-management
- password-security
- information-security
-
Definition (noun)
Entry #150 · UpdatedA Key Derivation Function (KDF) is a deterministic cryptographic algorithm that transforms secret input material—such as a user password, a Diffie-Hellman shared secret, or a high-entropy master key—into one or more pseudorandom cryptographic keys of specified lengths. By combining the source secret with non-secret parameters like cryptographic salts, context strings, or domain-separation labels through pseudorandom functions (PRFs) or cryptographic hashes, a KDF removes structural biases, binds derived keys to specific purposes, and isolates compromise so leaking one subkey does not expose sibling keys or the root secret. Depending on the threat model, a KDF either runs rapidly to expand high-entropy shared secrets into session keys or intentionally consumes heavy CPU time and memory to slow offline brute-force attacks against low-entropy passwords—distinguishing it from plain hash functions, which lack tunable work factors, domain separation, and formal key-extraction guarantees.
Common Types
Extract-and-Expand KDFs (HKDF): Two-stage constructions (standardized in RFC 5869) that first extract uniform randomness from non-uniform high-entropy secrets—such as Diffie-Hellman shared values—and then expand it with context labels into multiple independent keys for protocols like TLS 1.3 and Signal.
Key-Based KDFs (KBKDFs): Fast single-stage algorithms—such as NIST SP 800-108 counter, feedback, and double-pipeline modes—that apply a pseudorandom function like HMAC or AES-CMAC to derive subkeys directly from an already uniform master key in key hierarchies and hardware security modules.
Iteration-Based Password KDFs (PBKDF2 and bcrypt): Key-stretching functions for low-entropy human passwords that combine a unique random salt with thousands of sequential iterations (using HMAC in PBKDF2 or Blowfish key setup in bcrypt) to increase attacker brute-force costs.
Memory-Hard Password KDFs (scrypt and Argon2): Modern password-based KDFs that enforce configurable CPU work, parallelism, and large RAM allocations—with Argon2id combining side-channel resistance and memory hardness—to thwart massively parallel GPU and ASIC cracking hardware.
Example
When a user unlocks a local password manager vault with a master passphrase, the application runs the passphrase and a unique 128-bit random salt through Argon2id with a 64 MiB memory cost to derive a 256-bit master key while resisting offline GPU brute-force attacks. It then passes that master key into HKDF-SHA256 with distinct context labels (
vault-encandvault-auth) to expand separate keys for AES-256-CBC payload encryption and HMAC-SHA256 integrity verification.