Password hashes: how storage works and why offline guessing matters
Understand password verification, salts and cost factors, offline guessing after a database leak, and practical safeguards for service operators.
Password hashes: how storage works and why offline guessing matters
A password hash is the output of a one-way calculation on a password. A service should store a suitable password-hashing scheme result instead of the original password, then verify a login by processing the submitted value and comparing the result. A single fast general-purpose hash is not enough: use a unique salt per password and a scheme with a cost factor designed to make guesses expensive.
Hashing is not encryption
Encryption is designed to let someone with the key recover the original. A password-verification hash is used to check whether a submitted password matches, not to recover it. Storing encrypted passwords creates a route to the originals if the decryption key is exposed, so hashing is the usual choice for login-password storage.
At account creation or password change, the service generates a cryptographically random salt, processes the password with that salt and the selected scheme and parameters, then stores the salt, result, scheme name and parameters. It does not store the plaintext. At login, it processes the submitted password with the same salt and parameters and compares the result.
Hashing is not reversible, but a stolen hash file can still be guessed offline. An attacker computes likely passwords and compares each result. Short or common passwords and a fast hash make this cheaper. A per-password salt is public; it makes equal passwords produce different hashes and prevents reusing one precomputed result across accounts. A salt does not make a weak password strong, so the scheme must also raise the cost of each guess.
What NIST requires and recommends
For centrally verified passwords, NIST SP 800-63B-4 requires a suitable salted password-hashing scheme to resist offline attacks. A scheme takes the password, salt, and cost factor and returns a hash. The cost SHOULD be as high as practical without harming verifier performance and SHOULD increase over time. Store the salt and result; also store the scheme and cost metadata to support migration. NIST requires a salt of at least 32 bits and recommends minimizing collisions. It also recommends an additional keyed-hash or encryption step using a verifier-only secret key stored separately, preferably in hardware-protected storage.
NIST SP 800-132 has a different scope: it addresses deriving keys from passwords to protect stored data, not general login-password verification. Its publication page notes a planned revision from 2023. Check current applicable standards and validated libraries rather than treating that document as a complete login-hashing recipe.
Operator safeguards
Use a maintained, purpose-built password-hashing API from a trusted framework or library. Do not build a scheme by repeatedly calling a fast general hash.
Store each accountʼs salt, scheme/version, cost parameters and result. Salt is not a secret key and does not need to be hidden in a separate vault.
Tune the cost on production-like hardware. Balance offline resistance with verifier latency and load; limit concurrency and login rates so expensive processing cannot cause denial of service.
If using a pepper (verifier-only secret), keep it separate from the password database, ideally in an HSM or other protected environment. Plan secure backup, rotation, recovery and loss handling.
Version settings and migrate gradually: after successful verification with an old scheme, recompute with current settings. Test the logic and account-lockout impact.
Limit database access. After exposure, assess affected hashes and parameters; require targeted password changes as appropriate and revoke sessions or tokens. Hashing does not guarantee every password remains secret after a breach.
Users cannot usually inspect a serviceʼs internal hash. Use unique passwords and a password manager to generate long random values. If a service reports a breach or you see unusual account activity, change the affected password and every reused instance, then review sessions, MFA, and recovery settings.
Sources
[NIST SP 800-63B-4: Authenticator and Verifier Requirements](https://pages.nist.gov/800-63-4/sp800-63b/authenticators/)
[NIST SP 800-63B-4: Strength of Passwords](https://pages.nist.gov/800-63-4/sp800-63b/passwords/)
[NIST SP 800-132: Password-Based Key Derivation for Storage Applications](https://csrc.nist.gov/pubs/sp/800/132/final)