Module 10 Β· Authentication β Lesson 1 of 3 Β· ~11 min
Password hashing
Never store the password
PawWalk needs accounts: a walker signs up with an email and a password, and later logs back in. The tempting mistake is to save that password in the database as-is. Don't. If your database ever leaks β a backup goes missing, a query is logged, an intern runs the wrong SELECT β every plaintext password is exposed, and people reuse passwords everywhere.
The rule every backend follows: you never store the password, you store a one-way hash of it. A hash is a fingerprint β you can compute it from the password, but you can't run it backwards to recover the password. At login you hash what the user typed and compare fingerprints.
Even you, the person who runs the server, should be unable to recover a user's password. That's the whole point.