Passwords & identity

What Is Password Hashing? Salts, Argon2, bcrypt and How It Protects You

Good sites never store your actual password. They store a hash of it — and the difference decides whether a breach exposes your login or just useless math.

Cysoro Security TeamPublished · 9 min read
correct-horseyour password — never stored $argon2id$v=19$…the hash — what gets stored + SALT SLOW PASSWORDS & IDENTITY Passwordhashing One way. Salted. Deliberately slow.
Quick answer

Password hashing is the process of running a password through a one-way, deliberately slow algorithm to produce a fixed-length string called a hash. The site stores the hash, not your password, so a stolen database does not hand attackers your login. A unique random salt is added to each password first, and modern schemes such as Argon2id, scrypt, bcrypt and PBKDF2 make each guess expensive to compute.

Key takeaways

  • Password hashing is one-way: a hash cannot be turned back into your password, unlike encryption.
  • A unique salt per password stops rainbow tables and makes identical passwords hash differently.
  • Use Argon2id for new systems, scrypt as the fallback, bcrypt for legacy systems, and PBKDF2 where FIPS-140 compliance is required.

No well-run website stores your actual password. When you create an account, the site runs your password through a one-way mathematical process and stores the result — a hash. If that database is stolen, the thief gets a pile of hashes, not a pile of passwords. Whether those hashes are useful to the thief depends entirely on how the site did the hashing.

What is password hashing?

Password hashing is the process of converting a password into a fixed-length string, called a hash, using a one-way algorithm. The site stores the hash instead of your password, and at login it hashes what you type and compares the two hashes.

The key word is one-way. You can compute the hash from the password, but you cannot compute the password from the hash. That is the whole point: even someone with full access to the database cannot simply read your password out of it.

Hashing is not encryption. Encryption is two-way — anyone with the key can turn ciphertext back into the original. Hashing has no key and no reverse step. OWASP is blunt about this: passwords should be hashed with a modern, slow algorithm, not encrypted and never stored in plain text. You can see a hash being produced with our free hash generator.

How does password hashing work?

When you create an account, the site takes your password, adds a unique random salt, and runs the combination through a password hashing algorithm. It stores the resulting hash, the salt and the algorithm settings together, and throws the password away.

At your next login, the site repeats the same process on the password you just typed, using the stored salt and settings, and compares the new hash with the stored one. If they match, you are in. The site never needs to know your password — only whether the two hashes agree.

How password hashing works At signup password + unique salt run through Argon2id store the hash, never the password At login hash what you typed, same salt compare the two hashes match = you are in What is stored in the database algorithm + settings + salt + hash, for example: $argon2id$v=19$m=19456,t=2,p=1$salt$hash
Signup and login with password hashing. The password itself is never stored. Illustration by Cysoro.

Modern password hashing functions store their settings with each hash, in a standard format called the PHC string. That matters because it lets the site raise the work factor later and re-hash your password the next time you log in, without a mass password reset.

Why must password hashing be slow?

Password hashing is deliberately slow because a fast hash lets an attacker test billions of guesses per second. A slow, memory-hungry algorithm forces each guess to cost real time and memory, so cracking even one weak password becomes expensive.

Ordinary hash functions such as SHA-256 and MD5 were designed to be fast, which is exactly why they are wrong for passwords. A modern graphics card can compute billions of SHA-256 hashes per second. Password hashing algorithms such as Argon2id, scrypt, bcrypt and PBKDF2 are built the other way round: tunable, so the site can make each hash take a fraction of a second.

That delay is fast enough for one login, yet far too slow for a billion guesses. NIST's digital identity guidelines require passwords to be salted and hashed with a suitable scheme, with a cost factor as high as practical.

OWASP recommends that a single hash take less than one second to compute. That balance is the "work factor": high enough to hurt attackers, low enough that your login still feels instant.

What is a salt, and why does every password need one?

A salt is a unique random value mixed into each password before hashing. It guarantees that two users with the same password end up with completely different hashes, and it defeats rainbow tables — precomputed lists of hashes for common passwords.

Without a salt, an attacker who steals a database can hash "password123" once and instantly find every account that used it. With a salt, the attacker must redo the work for every single account, because every hash used a different salt. Salts are not secret — they are stored next to the hash — but they must be random and unique per password.

NIST SP 800-63B-4 requires salts of at least 32 bits, chosen so no two accounts share one. In practice, libraries generate 128-bit salts, which is also what RFC 9106 recommends for Argon2. If you want to check whether your own passwords have already appeared in a breach, use our pwned password checker.

What is a pepper?

A pepper is a secret value shared across all stored passwords and kept outside the database, for example in a secrets vault or a hardware security module. If only the database leaks, the attacker is missing a piece needed to test guesses at all.

A pepper differs from a salt in two ways: it is the same for every password, and it must stay secret. NIST describes the same idea as a keyed hashing step using a secret stored separately from the hashes, ideally in a hardware security module. OWASP calls peppering an extra layer of defense in depth, not a replacement for salting and a good algorithm.

Peppers have a real cost: if a pepper is compromised, every password protected by it must be reset, because the pepper cannot be changed without knowing each user's password. For most small teams, a strong algorithm, unique salts and a sensible work factor matter far more than adding a pepper.

Which password hashing algorithms are used today?

Four algorithms dominate in 2026: Argon2id is the first choice for new systems, scrypt is the fallback, bcrypt survives in legacy systems, and PBKDF2 is the route when FIPS-140 compliance is required. All four are slow and tunable; they differ in what makes them expensive. The OWASP Password Storage Cheat Sheet sets the minimum settings for each one.

AlgorithmWhat makes it costlyWhen to use itOWASP minimum setting
Argon2idMemory and CPU timeFirst choice for new systems19 MiB memory, 2 passes, parallelism 1
scryptMemory and CPU timeWhen Argon2id is unavailableN=2^17, r=8, p=1
bcryptCPU timeLegacy systems onlyWork factor 10 or more
PBKDF2Iteration countFIPS-140 compliance required600,000 iterations, HMAC-SHA-256
MD5 / SHA-256Nothing — built for speedNever for passwordsNot suitable

Argon2id: the modern default

Argon2 won the Password Hashing Competition in 2015 and was standardized as RFC 9106 in 2021. Its key idea is memory hardness: each hash needs a large block of RAM, which is expensive to replicate across thousands of GPU cores.

Argon2 comes in three variants. Argon2d resists GPU cracking but is more exposed to side-channel attacks; Argon2i takes the opposite trade-off. Argon2id blends both, which is why OWASP and the RFC point to it. OWASP lists five minimum settings of equal strength, from 46 MiB with 1 pass down to 7 MiB with 5 passes.

scrypt: the fallback

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, r=8 and p=1, which uses about 128 MiB of memory per hash.

bcrypt: legacy only

bcrypt is a long-established workhorse, but OWASP now says it should only be used in legacy systems where Argon2 and scrypt are unavailable. Its work factor should be 10 or more. It has one quirk worth knowing: most implementations read only the first 72 bytes of a password, so longer passwords are silently truncated.

PBKDF2: the compliance route

PBKDF2 is specified in NIST SP 800-132 and remains the choice where FIPS-140 validated cryptography is required. OWASP recommends at least 600,000 iterations with HMAC-SHA-256. It is not memory-hard, so it resists GPUs less well than Argon2id or scrypt — but it is the approved option in regulated environments.

Password hashing vs encryption vs encoding: what is the difference?

Hashing is one-way, encryption is two-way, and encoding is not security at all. Mixing them up is one of the most common mistakes in login design, so the distinction is worth nailing down.

MethodReversible?Right for passwords?Example
HashingNoYes — the correct choiceArgon2id, bcrypt
EncryptionYes, with the keyNo, except rare legacy casesAES-256
EncodingYes, triviallyNeverBase64
Plain textAlready readableNeverStoring the password itself

Encryption only makes sense for passwords in the rare case where the original password must be recovered, such as feeding a legacy system that cannot use modern delegated sign-in. Encoding, such as Base64, only changes how data looks — anyone can decode it instantly. If a site stores your password in plain text or Base64, change that password and stop using the site.

What happens when hashed passwords are stolen?

When a breach exposes hashed passwords, attackers try to crack them offline: they guess passwords, hash each guess with the same algorithm and salt, and compare. Weak passwords fall fast; strong ones stored with a modern algorithm effectively never fall.

This is why the algorithm matters so much. With unsalted MD5, an attacker can test billions of guesses per second and recover most common passwords in minutes. With Argon2id at OWASP minimum settings, each guess costs real memory and time, so the same attack becomes impractical. The breach still matters — change the password — but the hash bought you time.

It is also why reuse is so dangerous. If your password appears in one breach, attackers try it everywhere else. Have I Been Pwned's Pwned Passwords service catalogs passwords that have appeared in breaches, and NIST recommends checking new passwords against such a list. Test your own password strength with our password strength checker.

Common password hashing mistakes to avoid

Most password storage failures are not exotic. They are the same few mistakes, repeated: a fast hash, no salt, a fixed work factor, or a home-grown scheme. Avoid these and you avoid nearly all of it.

  • Using a fast hash. MD5, SHA-1 and plain SHA-256 are designed for speed, not password storage. Never use them for passwords.
  • Skipping the salt. Without unique salts, one cracked password exposes every account that shared it, and rainbow tables do the rest.
  • Using one salt for everyone. A single shared salt is barely better than none. Generate a fresh random salt per password.
  • Never raising the work factor. Hardware gets faster every year. Re-hash on login so old hashes are upgraded to current settings.
  • Rolling your own algorithm. Use a maintained library — Argon2, bcrypt or PBKDF2 from your framework — and never hand-roll salts or encodings.
  • Storing passwords encrypted. Encryption means anyone who gets the key gets every password. Hash instead.
  • Truncating silently. If you use bcrypt, enforce a 72-byte maximum or pre-hash safely, so users are not misled about their password length.

NIST SP 800-63B-4 adds password rules that pair with good hashing: at least 15 characters for a password used on its own, at least 64 allowed, no forced composition rules, no periodic expiry, and a blocklist check against known breached passwords.

What should you do as a user?

You cannot control how a website hashes your password, but you can control the two things that matter most to you: the strength of the password itself, and whether it is reused anywhere. A long, unique password plus multi-factor authentication beats a short one on even the best-hashed site.

Your part of the deal 1. Long and unique 15+ characters, different for every account you care about 2. Use a password manager it remembers the long ones so you do not have to 3. Turn on MFA a second factor protects you even if a hash is cracked 4. Check for breaches if a password appears in a breach, change it everywhere
Four habits that protect you no matter how a site stores passwords. Illustration by Cysoro.

Use a password manager to generate and store a different long password for every account. Turn on multi-factor authentication wherever it is offered — ideally a passkey or security key. And if you learn a service you use was breached, change that password immediately, plus anywhere you reused it. For a wider starting point, our small business cybersecurity checklist covers passwords alongside backups, updates and device security.

The bottom line

Password hashing is what stands between a stolen database and a stolen account. A modern algorithm, a unique salt per password and a work factor that rises with hardware turn a breach into an inconvenience instead of a catastrophe.

If you build login systems, use Argon2id at OWASP minimum settings and re-hash on login. If you just use the web, pick long, unique passwords, use a manager, and turn on MFA. You can check any password against known breaches in seconds with the free pwned password checker.

Frequently asked questions

What is password hashing in simple terms?

Password hashing turns your password into a scrambled, fixed-length code that cannot be reversed. A site stores that code instead of your password, then hashes what you type at login and compares the two codes. If they match, you are in.

Is password hashing the same as encryption?

No. Encryption is two-way: anyone with the key can decrypt the data back to the original. Hashing is one-way: you can compute the hash from the password, but you cannot compute the password from the hash. That is why hashing is the right tool for storing passwords.

What is a salt in password hashing?

A salt is a unique random value added to each password before it is hashed. It makes identical passwords produce different hashes, defeats precomputed rainbow tables, and forces an attacker to crack each password separately. NIST requires salts of at least 32 bits.

Which password hashing algorithm should I use in 2026?

Use Argon2id for new systems. Use scrypt if Argon2id is unavailable, bcrypt only for legacy systems where the others are not available, and PBKDF2 with 600,000 iterations of HMAC-SHA-256 where FIPS-140 compliance is required.

Can a hashed password be cracked?

Yes, if the password is weak or the hashing is outdated. Attackers guess common passwords, hash each guess the same way, and compare. Strong, unique passwords stored with Argon2id and a unique salt are effectively impossible to crack with current hardware.

What is the difference between hashing and salting?

Hashing is the one-way transformation itself. Salting is the extra step of mixing a unique random value into each password before hashing. Hashing without salting is weak, because the same password always produces the same hash and rainbow tables can reverse common ones.

Do I need to hash passwords if I use a password manager?

Yes, but that is the website's job, not yours. Your job is to use a strong, unique password for every account and turn on multi-factor authentication. A password manager helps you do that without reusing passwords.

What happens to my hashed password if a site is breached?

Attackers get the hashes, not your passwords. If the site used a modern algorithm, a unique salt and a sensible work factor, the hashes are of little use. If it used a fast hash such as MD5 or SHA-256 with no salt, common passwords can be recovered quickly, so change that password everywhere you reused it.

Sources

  1. OWASP — Password Storage Cheat Sheet
  2. NIST — SP 800-63B-4 Digital Identity Guidelines: Authentication and Authenticator Management
  3. NHIM Group — Password Hashing and Key Derivation Guide
  4. Software Security — Password hashing: Argon2id, scrypt, bcrypt and PBKDF2
  5. IntentSec — Argon2id vs bcrypt vs scrypt vs PBKDF2: How to Store Passwords Safely in 2026
Written & fact-checked byCysoro Security Team

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.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the OWASP Password Storage Cheat Sheet, NIST SP 800-63B-4 and RFC 9106.

How we write and fact-check →

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free