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.
Purpose
It turns human passwords (low entropy) into sufficiently long encryption keys while resisting dictionary and rainbow-table attacks.
Mechanism
A KDF takes a password, salt, iteration/cost parameters, and output length, and produces a pseudorandom key. Iterations multiply the per-attempt cost; salt prevents precomputed tables; memory-hard KDFs (scrypt/Argon2) additionally resist GPU/ASIC parallelism.
Use cases
- Encrypted storage of user passwords
- Disk-encryption master key derivation
- TLS session key derivation (HKDF)
- API token generation
Examples
- Input
password + salt + 100000 itersOutput256-bit keyIterations multiply the cost
Common errors
- Hashing passwords with a raw SHA (no salt, no iterations)
- Use PBKDF2, scrypt, or Argon2
Related terms
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. GLOSSARY
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
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
Hash Salting
Hash salting is adding a random salt to the hash input so identical inputs produce different hashes, defeating rainbow tables and collision detection. GLOSSARY
Related tools
PBKDF2 Key Derivation
Derive a key from a password using PBKDF2 (RFC 2898) with Web Crypto API. Free, private, and 100% client-side. TOOL
scrypt Key Derivation
Derive a key from a password using scrypt (memory-hard KDF). Free, private, and 100% client-side. TOOL
bcrypt Hash
Hash passwords with bcrypt or verify bcrypt hashes. Free, private, and 100% client-side. TOOL