Every website you log into stores something in a database — but if they are doing their job, it is not your password. It is a hash: the output of a one-way mathematical function. When you log in, the site hashes what you typed and compares it to the stored value. Your real password never sits on disk.
The naive approach is to use a fast cryptographic hash like MD5 or SHA-256. Fast sounds good, right? In 2009 the website RockYou was breached and 32 million passwords were stolen — stored in plain text. Sites that used fast hashes fared little better. Within days, attackers with commodity GPUs had cracked most of them by hashing billions of guesses per second until they matched.
The fundamental insight of modern password hashing is: make the hash function deliberately, tuneably slow. Not slow for the user logging in — one hash taking 100 ms is imperceptible. But slow enough that checking a billion guesses takes not hours but centuries.
Three algorithms define the field. bcrypt (Niels Provos and David Mazières, 1999) introduced a work factor that exponentially scales cost. scrypt (Colin Percival, 2009) added memory-hardness so that cheap custom hardware loses its advantage. Argon2 (Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich, 2015) — winner of the Password Hashing Competition — lets you tune time, memory, and parallelism independently. All three are deliberately polynomial-in-the-work-factor slow, and that is not a bug. It is the entire security guarantee.
Comments
Loading comments...