Hashes, passwords, and MACs
Hash passwords slowly
Store password verifiers with Argon2id or another current password-hashing construction instead of fast hashes or reversible encryption.
8 minute lesson
Password storage has a special threat: an attacker can guess offline after stealing the database.
Use a maintained password library and current OWASP parameters. The function should be deliberately expensive in time and memory. Store the encoded algorithm, parameters, salt, and result, never the original password.
An attacker steals a user table containing unsalted SHA-256 password hashes. They can test billions of common guesses offline without contacting the application or triggering a rate limit.
Argon2id raises the time and memory cost for every guess. Raising it too far can exhaust login servers, so measure on production-like hardware and keep request-level abuse controls.
Benchmark a maintained Argon2id implementation with current OWASP guidance on production-like hardware and save latency plus memory settings. Verify a known password and reject a wrong one. Then run several concurrent hashes and show that the chosen cost remains within the service resource budget.
Lesson completed