What is a key derivation function?
A key derivation function turns a human-chosen password into a fixed-length cryptographic key. Because passwords are short and predictable while keys must be neither, a KDF stretches the input through thousands of expensive operations, making each attacker guess costly. PBKDF2, bcrypt, scrypt, and Argon2 are the common choices.
- Topic
- Cryptography
- Also called
- KDF
- Reading time
- 1 min
- Reviewed
On this page
Why not just hash the password once
A single SHA-256 pass takes microseconds, which means an attacker with a GPU can test tens of billions of candidate passwords per second. A KDF deliberately makes that one operation take a meaningful fraction of a second, collapsing the attacker's throughput by five or six orders of magnitude.
The three hardness properties
Compute-hard functions cost CPU time (PBKDF2). Memory-hard functions additionally demand large amounts of RAM per guess, which defeats the cheap parallelism of GPUs and custom silicon (scrypt, Argon2). Argon2id combines both and is the current recommendation where it is available.
Sources
These primary references support the terminology and current security guidance used in this definition.
