A password hash is a fixed-length string produced by running a password through a one-way cryptographic hashing function, so the original password cannot be recovered from the stored value. At login the site hashes the password you enter and compares it with the stored hash. Secure systems add a unique random salt per password and use a slow, memory-hard algorithm such as Argon2id, bcrypt or PBKDF2 so stolen hashes are expensive to crack.
Key takeaways
- A password hash is one-way: the site verifies your password by re-hashing it, never by storing or reversing it.
- A unique random salt per password stops rainbow-table attacks and makes identical passwords produce different hashes.
- Use Argon2id for new systems, scrypt as a fallback, bcrypt only for legacy systems, and PBKDF2 where FIPS-140 compliance is required.
No website should ever store your password. Instead, good sites store a password hash — a scrambled, one-way version of it. If the database leaks, attackers get hashes, not passwords, and the difference between a safe breach and a catastrophe is usually how those hashes were made.
What is a password hash in cyber security?
A password hash is a fixed-length string created by feeding a password through a one-way cryptographic hash function. The process cannot be reversed, so the original password cannot be recovered from the hash alone. At login, the system hashes the password you type and compares the result with the stored hash.
Think of it like a fingerprint of your password: the same password always produces the same hash with the same settings, but the hash itself reveals nothing useful about the password. OWASP states the rule plainly — passwords must never be stored in plain text and must be protected with strong, slow hashing algorithms such as Argon2id, bcrypt or PBKDF2, plus a unique salt per password.
Hashing is not the same as encryption. Encryption is two-way: data can be decrypted with a key. Hashing is one-way, which is exactly what you want for a password, because the site never needs to know the password itself — it only needs to check whether the one you typed matches.
How does password hashing work?
Password hashing works in three steps: the password is combined with a unique random salt, the combination is run through a deliberately slow hashing algorithm, and the resulting hash — together with the salt and the algorithm settings — is stored. At login, the same steps are repeated and the two hashes are compared.
Modern schemes store everything needed for verification in a single string: the algorithm name, its cost parameters, the salt and the hash. OWASP recommends this format because it lets a team change the algorithm or raise the cost later without breaking existing logins.
A bcrypt hash, for example, is 60 characters long and starts with $2b$, followed by the work factor, 22 characters of salt and 31 characters of hash. An Argon2id hash starts with $argon2id$v=19$ and lists its memory, iteration and parallelism settings in plain sight. The algorithm does not need to be secret — the cost of guessing does the protecting.
What is the difference between hashing and encryption?
Hashing is one-way and encryption is two-way. You can decrypt encrypted data with the right key, but you cannot decrypt a hash — you can only test whether a guessed password produces the same hash. That makes hashing the right tool for storing passwords.
| Property | Hashing | Encryption |
|---|---|---|
| Reversible? | No — one-way only | Yes — with the key |
| Output length | Fixed, whatever the input | Varies with the input |
| Needs a key? | No key; a salt is added instead | Yes, a secret key |
| Use for passwords | Yes — the standard approach | Only in rare edge cases |
| If the database leaks | Attackers must guess each password | Attackers with the key get every password |
| Examples | Argon2id, bcrypt, PBKDF2, scrypt | AES, ChaCha20 |
OWASP notes one narrow exception: encryption is used only when an application genuinely needs the original password back, for example to log in to a legacy system that does not support modern authentication. Wherever possible, the architecture should be changed to avoid that need.
For users, the practical difference matters when a breach is announced. If a company stored passwords encrypted and the key was also stolen, every password is exposed. If it stored them properly hashed and salted, attackers still have to crack each one individually — and with a strong algorithm and a strong password, that is usually not worth their time.
What is salting, and why does every password need a unique salt?
Salting means adding a unique, random value to each password before hashing it. The salt makes identical passwords produce completely different hashes, so an attacker cannot crack thousands of accounts with one calculation or use precomputed rainbow tables.
Without a salt, every user with the password Summer2026! would have the same hash. An attacker could hash a dictionary once and instantly match every account that used a common password. With unique salts, the attacker must repeat the whole expensive computation separately for every single account.
The salt does not need to be secret, and it is stored alongside the hash. NIST SP 800-63B requires a salt of at least 32 bits. Its job is uniqueness, not secrecy — the algorithm's cost is what resists guessing, as the OWASP Password Storage Cheat Sheet explains.
A pepper is the salt's secret cousin: a value shared across all passwords, stored separately from the database — ideally in a secrets vault or hardware security module. If attackers steal only the database, a pepper stops them cracking any hash at all. But if the pepper itself is compromised, every affected user must reset their password, because a pepper cannot be changed without knowing the original passwords.
Which password hashing algorithms should be used in 2026?
For new systems, use Argon2id. If it is unavailable, use scrypt. Use bcrypt only for legacy systems, and PBKDF2 only where FIPS-140 compliance is required. That is the OWASP recommendation, and it reflects a simple principle: password hashing must be slow and memory-hungry, the opposite of fast general-purpose hashes.
Argon2id
Argon2 won the 2015 Password Hashing Competition, and Argon2id is its recommended variant, balancing resistance to GPU attacks and side-channel attacks. It is defined in RFC 9106. OWASP's minimum configuration is 19 MiB of memory, 2 iterations and parallelism of 1, with higher-memory options (46 MiB with 1 iteration, or 7 MiB with 5 iterations) offering the same level of defense.
scrypt
scrypt is a memory-hard password-based key derivation function created by Colin Percival. OWASP recommends it when Argon2id is not available, with a minimum of N = 2^17 (128 MiB), block size 8 and parallelism 1.
bcrypt
bcrypt was created in 1999 specifically for password hashing and remains widely used because it is battle-tested and built into most languages. It generates and stores a unique salt automatically and uses a configurable cost factor. OWASP says it should only be used for legacy systems, with a work factor of 10 or more. One limit to know: bcrypt ignores input beyond 72 bytes.
PBKDF2
PBKDF2 is specified by NIST SP 800-132 and is the route to take when FIPS-140 compliance is required. OWASP recommends 600,000 or more iterations with HMAC-SHA-256. It is CPU-hard but not memory-hard, so it is weaker against GPU-based guessing than Argon2id or scrypt.
How do attackers crack password hashes?
Attackers crack hashes by guessing: they take a candidate password, hash it with the victim's salt and settings, and check whether it matches. They repeat this with dictionaries, lists from earlier breaches, and brute force — and with fast hardware, weak passwords fall in seconds.
Three things decide whether a stolen hash database turns into a mass compromise. First, the algorithm: fast hashes such as MD5 or plain SHA-256 let GPUs try billions of guesses per second, while Argon2id forces each guess to use memory and time. Second, the password itself: short, common or reused passwords appear in every attacker's wordlist. Third, the salt: without unique salts, one computation cracks every account sharing a password.
That is why a breach announcement that says "passwords were hashed" is not enough information on its own. Hashed with what, and salted? A salted Argon2id hash of a long, unique password is effectively uncrackable; an unsalted MD5 hash of password123 is cracked before the announcement is finished.
If your password appears in a known breach, change it everywhere you reused it. You can check safely with our pwned password checker, which never sends your full password anywhere.
What should you do if a service leaks password hashes?
Change that password immediately, and change it anywhere else you used the same one. Then turn on two-factor authentication, check for suspicious sessions, and switch to a password manager so every account gets a unique password.
- Change the leaked password first — do it from the real site, not from a link in a breach notification email.
- Change it everywhere you reused it. Reuse is what turns one breach into many compromised accounts.
- Turn on two-factor authentication, preferably with a passkey or security key, which stays safe even if the password leaks again.
- Review active sessions and connected apps, and sign out anything you do not recognize.
- Generate a new password with a password manager. Our free password generator creates long, random passwords you do not have to memorize.
For a wider check of your accounts, our guide to how to know if your phone is hacked covers the signs that a stolen credential is already being used.
How should developers store passwords correctly?
Developers should never write their own password hashing. Use a vetted library, pick Argon2id with OWASP's minimum settings, generate a unique random salt per password, and store the algorithm, parameters, salt and hash together so the cost can be raised later.
- Never store passwords in plain text or with reversible encryption. Hash them with a modern, adaptive algorithm.
- Never use MD5, SHA-1 or plain SHA-256 for passwords. They are fast by design, which is the opposite of what password storage needs.
- Let the library generate the salt. Most modern libraries do this automatically; hand-rolled salt code is a classic source of bugs.
- Raise the work factor over time. Re-hash passwords with stronger settings when users next log in, as hardware gets faster.
- Consider a pepper stored in a secrets vault or hardware security module for defense in depth.
- Add breach checking. Reject passwords that appear in known breach lists at signup and password change.
- Enforce a minimum length (NIST SP 800-63B sets 8 characters as the floor for user-chosen passwords) and allow long passphrases.
Small teams can also reduce their exposure by letting users sign in with passkeys instead of passwords at all — then there is no password hash to protect. Our small business cybersecurity checklist covers password policy alongside backups, updates and MFA.
The bottom line
A password hash is your password's one-way fingerprint: it lets a site verify you without ever storing the thing that would let an attacker become you. Salts make each hash unique, and slow, memory-hard algorithms like Argon2id make guessing expensive.
As a user, your part is simple: use long, unique passwords and turn on two-factor authentication. Check how strong your current passwords are with our free password strength checker — and if any password is reused anywhere, change it today.
Frequently asked questions
What is a password hash in simple terms?
A password hash is a scrambled, one-way version of a password. A website stores the hash instead of the password, and checks your login by hashing what you type and comparing the two hashes.
Can a password hash be reversed?
No, a hash cannot be reversed. The only way to find the password is to guess candidates, hash each one, and see if it matches. Strong algorithms and strong passwords make that impractical.
What is the difference between hashing and encryption?
Hashing is one-way: you cannot decrypt a hash back into a password. Encryption is two-way: data can be decrypted with the right key. Passwords should be hashed, not encrypted.
What is a salt in password hashing?
A salt is a unique random value added to each password before hashing. It makes identical passwords produce different hashes and defeats precomputed rainbow-table attacks. NIST requires salts of at least 32 bits.
Which password hashing algorithm is best in 2026?
OWASP recommends Argon2id as the first choice for new systems, with scrypt as the fallback, bcrypt only for legacy systems, and PBKDF2 where FIPS-140 compliance is required.
What should I do if a site leaks password hashes?
Change that password immediately, change it anywhere else you reused it, turn on two-factor authentication, and switch to unique passwords generated by a password manager.
Sources
- OWASP — Password Storage Cheat Sheet
- NIST — SP 800-63B, Digital Identity Guidelines: Authentication and Lifecycle Management
- IETF — RFC 9106, Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications
- HeyData — What Is Salting in Security? Password Hashing and Salting Explained
- Encryption Consulting — Password Hashing: bcrypt vs. Argon2 vs. PBKDF2
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the OWASP Password Storage Cheat Sheet, NIST SP 800-63B and RFC 9106 (Argon2).
How we write and fact-check →