Slow password hashes
A password database will be copied eventually. A slow, uniquely salted hash makes guessing expensive. A fast hash makes the copy a password list.
Diagram
From a copied table to a guess that should be expensive
Step 1 of 4
Store
The server stores a verifier for the password, not the password.
# The database stores the hash. # It does not store the password.
A general-purpose hash, maybe with no unique salt.
Guesses are cheap offline.
Your rate limit never sees them.
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
4 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Offline is a different budget
- What fails
- Login rate limits slow a stranger at your front door. A copied table is guessed on someone else’s hardware. The hash has to be slow there.
- Who is affected
- Every account in the table, and every other site where the password was reused.
- What you would notice
- SHA-1, MD5, or a single SHA-256 with no password-hashing parameters.
- What you change
- Move to a password hashing algorithm. Do not “fix” a fast hash by hashing it once more with another fast hash.
Salt is not slowness
- What fails
- A unique salt stops two identical passwords from producing the same verifier, and it stops precomputed tables of unsalted guesses. It does not make one guess expensive.
- Who is affected
- Users who chose common passwords, if the hash is still fast.
- What you would notice
- A salt column next to MD5, described as the whole control.
- What you change
- Salt and a slow algorithm. You need both. The salt is random per password, not a site-wide pepper standing alone.
Parameters age
- What fails
- Memory and time costs that were heavy years ago get cheaper. Record them. Raise them on a schedule. Rehash when a user logs in.
- Who is affected
- The next copy of the table, if parameters never move.
- What you would notice
- A bcrypt cost or an Argon2 memory setting nobody can find in the code.
- What you change
- Name the numbers in the same place as the algorithm. Test that login still fits your latency budget.
The password is still a password
- What fails
- A slow hash does not stop stuffing against the live site, and it does not stop phishing. It limits the damage of a copied table.
- Who is affected
- Account holders, for those other failures, until you add the breach check and a better factor.
- What you would notice
- A program that only changes the hash and deletes the rate limit as “no longer needed.”
- What you change
- Keep the online controls. Read the breached-password lesson beside this one.
The copy is guessed somewhere else
Password verifiers exist so you can check a login without storing the password. If the verifier is a fast hash, anyone who copies the table can try guesses at the speed of that hash, on hardware you do not control. Your account lockout, your captcha, and your monitoring do not run there. The algorithm is the control that still exists after the copy.
Use a password hashing function: Argon2id is the current default to prefer, and bcrypt or scrypt are the other names you will meet in real systems. They are built to cost memory and time on purpose. A general-purpose hash is built for the opposite. Wrapping one fast hash in another does not change the category.
Salt, pepper, and parameters
A unique salt per password, stored with the verifier, means two users with the same password do not look the same, and a precomputed table has to be rebuilt per salt. That is necessary. It is not slowness. A site-wide pepper in a secret store can add a hurdle if the store is not copied with the table. It is an extra. It does not replace the slow algorithm, and a pepper stored in the same database as the hashes is just more salt with worse rotation.
Record the parameters: memory, time, parallelism, or the bcrypt cost. Raise them when hardware gets cheaper, and rehash the verifier the next time the person logs in correctly. You cannot rehash a password you do not have. You can rehash one they just submitted, after you check the old verifier.
Online attacks are still online
A slow hash does not stop someone from trying leaked passwords against your login form. That is stuffing, and it is limited by rate limits, breach checks, and a second factor. Teams sometimes delete the rate limit when they adopt bcrypt because “the hash is slow now.” The hash is slow for the defender’s check too, which is fine, and it does nothing to stop a botnet from trying one password per account. Keep both.
You would notice MD5 or SHA-1 in the user table, a salt column described as the entire design, parameters nobody can quote, and a login path that still accepts a password from a breach list. The people affected are the account holders if the table is copied, and the other sites where they reused the password. The finding names the algorithm. It does not include a method for recovering a password, and it does not include the table.
What you change
Replace the verifier. On login, if the stored verifier is the old kind, check it, then write a new one and delete the old. Invalidate sessions you cannot account for if you know the table was copied. Add the breach check and the rate limit if they are missing. Test with passwords you invented for the test, and assert the stored string is not the password and is not a single fast hex digest.
Read your library’s current guidance for the parameters. The numbers in the sample on this page are a starting point a reviewer can recognize, not a law. If the vendor’s current page says something different for your deployment, follow the vendor and write down why. The property to preserve is cost per guess, a unique salt, and no password in the row.
Check yourself
Recognition and the fix. Nothing here is a procedure.
The user table stores unsalted SHA-256 of the password. The login is rate-limited. What fails if the table is copied?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.