PBKDF2 Key Derivation
Generate secure cryptographic keys from passwords
PBKDF2 Documentation
PBKDF2 (Password-Based Key Derivation Function 2) is a cryptographic standard defined in RFC 8018. It transforms a password into a secure cryptographic key through iterative hashing, making brute-force attacks computationally expensive.
PBKDF2 is widely adopted in security protocols including WPA2 WiFi encryption, iOS data protection, macOS FileVault, and numerous enterprise password storage systems. Its NIST-approved status makes it the go-to choice for compliance-sensitive applications.
How PBKDF2 Works
PBKDF2 applies a pseudorandom function (HMAC-SHA256 by default) iteratively to generate a derived key:
- Takes a password, salt, iteration count, and desired key length as inputs
- Applies HMAC with the password as key and salt + counter as message
- Repeats the HMAC operation for the specified number of iterations
- Concatenates intermediate results to produce the final derived key
OWASP Recommended Iterations (2023)
The Open Web Application Security Project (OWASP) provides minimum iteration guidelines based on hash algorithm strength. These values are calibrated to ensure adequate protection against modern hardware attacks:
| Hash Algorithm | Minimum Iterations | Recommended |
|---|---|---|
| PBKDF2-SHA256 | 310,000 | 600,000+ |
| PBKDF2-SHA384 | 210,000 | 500,000+ |
| PBKDF2-SHA512 | 120,000 | 210,000+ |
| PBKDF2-SHA1 | 1,300,000 | Not Recommended |
Common Use Cases
- Deriving encryption keys for AES/ChaCha20 from user passwords
- Password storage and verification in authentication systems
- Generating deterministic keys from master passwords (password managers)
- Key derivation for disk encryption and secure containers
KDF Comparison: PBKDF2 vs Bcrypt vs Argon2
| Feature | PBKDF2 | Bcrypt | Argon2 |
|---|---|---|---|
| Standard | RFC 8018 | OpenBSD | RFC 9106 |
| Memory-Hard | No | Limited (4KB) | Yes |
| GPU Resistance | Low | Moderate | High |
| Best Use Case | FIPS/NIST compliance | Legacy systems | New applications |
Security Best Practices
- Always use a cryptographically random salt of at least 16 bytes (128 bits)
- Store the salt alongside the derived key - it is not secret
- Increase iterations annually to keep pace with hardware improvements
- Consider Argon2id for new systems requiring memory-hard protection against GPU attacks
Technical References
Related Tools
Password Hash Generator
Generate and verify secure password hashes using Bcrypt, Scrypt, and Argon2 algorithms
HMAC Generator
Generate HMAC authentication codes with MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3, and RIPEMD-160 algorithms
AES Encryption/Decryption
Securely encrypt and decrypt text using AES algorithm
SHA Hash Generator
Online SHA hash generator supporting SHA-1, SHA-256, SHA-384, SHA-512 algorithms