Auth's password-hashing lesson mentioned PBKDF2 as an acceptable alternative to bcrypt, treating it as just another password-hashing option. It's actually a different kind of tool — a key derivation function — solving a related but distinct problem this lesson separates out clearly.
3 min read
Symmetric encryption (lesson 2) needs a proper cryptographic key — effectively, a long, random-looking sequence of bits. A human-chosen password is nothing like that: it's short, drawn from a comparatively small space of likely human choices, and directly unsuitable for use as an AES key without something in between. A Key Derivation Function (KDF) turns a weak, human-chosen secret into a strong key suitable for actual cryptographic use.
Auth's password-hashing lesson used bcrypt to answer "how do I store a password so I can verify a login attempt later without keeping the plaintext." A KDF like PBKDF2 answers a related but genuinely different question: "how do I turn this password into an actual encryption key I can use to encrypt or decrypt data." The two use very similar techniques — both deliberately slow the computation down, both use a salt — but bcrypt's output (a hash to compare against) and a KDF's output (a usable encryption key) serve different downstream purposes.
A KDF like PBKDF2 or Argon2 combines ideas already covered:
Encrypting a file with "a password" doesn't mean using the password bytes directly as an AES key — it means running the password through a KDF (with a stored salt) to derive an AES-appropriate key, then using lesson 2's symmetric encryption with that derived key. This is exactly what tools like encrypted ZIP files or password managers do underneath a simple "enter your password" interface — the password itself never directly touches the encryption algorithm.
A derived key should generally be used for exactly the one purpose it was derived for — deriving one key from a password and then using that same raw derived value both as an encryption key and as an HMAC key (lesson 5) for a different purpose creates an unnecessary and often unanalyzed relationship between two supposedly independent operations. Real systems that need multiple keys from one password typically derive each one separately (often via a KDF specifically designed to expand one secret into multiple independent keys), rather than reusing one derived value everywhere it happens to be convenient.
Check your understanding
A quick comprehension check — not tracked, not graded, just for you.
1. Why is a human-chosen password unsuitable as a direct symmetric encryption key?
2. How does a KDF like PBKDF2 differ from password hashing with bcrypt, despite using similar techniques?
3. Why is reusing one derived key for multiple unrelated purposes (encryption and HMAC) a common mistake?
Cryptography Fundamentals