PBKDF2
PBKDF2 (Password-Based Key Derivation Function 2) is the KDF standardized in PKCS#5 that derives keys from passwords via iterated HMAC, widely used for password hashing and key derivation.
Purpose
It derives a high-entropy key from a low-entropy password, with the iteration count multiplying the cost of brute force.
Mechanism
DK = T1 || T2 || ..., where Ti = U1 ⊕ U2 ⊕ ... ⊕ Uc, U1 = HMAC(P, salt || i), Uj = HMAC(P, U_{j-1}). The iteration count c is typically ≥ 100000. It is CPU-hard only and does not resist GPU/ASIC parallelism.
Use cases
- Wi-Fi WPA2/3 key derivation
- iOS/Android password backups
- 1Password key derivation
- PKCS#12 key storage
Examples
- Input
password, salt, c=600000Output256-bit derived keyOWASP 2023 recommends ≥ 600000
Common errors
- Iteration count too low (e.g., 1000)
- Use at least 600000 (OWASP 2023)
Related terms
scrypt
scrypt is a memory-hard KDF designed by Colin Percival that resists GPU/ASIC parallel brute force through large memory requirements, used for password hashing and key derivation. GLOSSARY
Key Derivation
Key derivation is the process of generating encryption keys from low-entropy passwords or high-entropy master keys, using KDFs (e.g., PBKDF2, scrypt, Argon2) to raise the cost of brute force. GLOSSARY
Salt
A salt is a random value added during password hashing so identical passwords produce different hashes, defeating rainbow tables and same-password detection. GLOSSARY
HMAC
HMAC (Hash-based Message Authentication Code) is a message authentication code combining a hash function with a secret key, providing integrity and authenticity. GLOSSARY