Reading — step 1 of 5
Read
~1 min readProduction
Putting It All Together
Layers built:
| Layer | Lesson |
|---|---|
| Why hash | 1 |
| Salts | 2 |
| PBKDF2 | 3 |
| bcrypt | 4 |
| argon2 | 5 |
| Constant-time | 6 |
| Rehash on login | 7 |
What we glossed over:
- Pepper: a SECRET application-wide value mixed into hashing. Provides defense-in-depth. Stored in env, not DB.
- Multi-factor auth: TOTP, hardware keys, WebAuthn. Independent layer above passwords.
- Password policies: complexity rules, length minimums, breach lists (Have I Been Pwned).
- Account lockouts: throttle login attempts.
- Password reset flows: secure tokens, expiry, single-use.
Recommendations (2024):
- New code: argon2id, m=19MiB, t=2, p=1.
- Existing bcrypt: keep, bump cost to 12+.
- Anything else: migrate to bcrypt or argon2id ASAP.
- NEVER: SHA, MD5, custom XOR schemes.
Use a library. Don't implement primitives yourself. Side channels and parameter choices are subtle.
OWASP's Authentication Cheat Sheet is the best continuously-updated reference.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…