Lion Cipher Lab

Store passwords securely with bcrypt and Argon2

Why it matters

Storing a password is the most security-critical line of code most developers ever write, and it is deceptively easy to get catastrophically wrong. Reach for the 'obvious' tools — save the password as-is, or run it through a fast hash like SHA-256 or MD5 — and a single database leak hands attackers the accounts of everyone who reused that password anywhere else. The reason is concrete and worth feeling rather than memorizing: fast hashes are deterministic (the same password always produces the same hash, so a leak instantly reveals which users share a password and lets attackers match against…

What you'll learn

Steps in this lab

  1. The problem, and the ground rules
  2. Set up: confirm Python, make a clean sandbox, install the libraries
  3. See the wrong way, concretely: plaintext, then a fast deterministic hash
  4. The right way #1: bcrypt (battle-tested, salt baked in)
  5. The right way #2: Argon2id (the modern winner, memory-hard)
  6. Tune the cost and upgrade transparently
  7. The judgment: pepper, don't roll your own, and which algorithm when
  8. What you did — and the reflex to keep

Open the full interactive lab →