Passwords Done Right

Never store the real password

In 2012, LinkedIn's database of 6.5 million passwords leaked β€” stored as plain unsalted hashes, cracked in days, dumped online for anyone to search. The lesson the whole industry took from that: if your database is ever stolen, the attacker must NOT get everyone's real password. PawWalk's users table doesn't even have a column called password β€” it has password_digest, and nothing in the codebase ever writes a real password into it.

A digest is the one-way scramble of a password β€” feed in "walkies123", get back something like $2a$12$Q.yrgB7Ym9a9ev3geHF.zOH00IjlHUeJhtQ6HnA15qqx9C6AIDRvG. There's no function that turns that string back into "walkies123" β€” that's what "one-way" means.