DEV Community

Cyrus
Cyrus

Posted on

Ping64|Why Websites Store Passwords as Salted Hashes Instead of Plain Text

Every site that asks you to create a password faces a quiet question: where does that password go? Storing it as typed text would be simple, and it would also be a disaster the first time the database leaked. Salted hashing is the standard answer, and it is easier to understand than the name suggests.

This matters to you even if you never touch a server. When you hear that a company was breached, whether your password survives depends on choices made years earlier by its engineers. Knowing the mechanism helps you judge those news stories more calmly.


Two small words carry most of the weight. Hashing means the password is scrambled in a way that cannot be undone, and salting means each account gets its own random twist. The rest is detail.

Simple analogy

Think of a blender. Fruit goes in, a smoothie comes out, and no known process turns the smoothie back into whole fruit. The recipe is repeatable, though: the same fruit blend produces the same smoothie every time.

A hash function works like that blender for text. Passwords go in, a fixed-length scrawl comes out, and the site can check a login by blending your input again and comparing the result.

The blender analogy has one more useful edge. Two identical fruits dropped into two blenders produce two identical smoothies, which is exactly the problem salts were invented to break. A pinch of different spice per batch separates them.

Core mechanism

When you sign up, the site does not store your password. It stores the hash, which is a scrambled fingerprint of it. When you log in later, the site hashes what you typed and compares the two fingerprints, so the original password never needs to sit on disk.

Plain hashing has a weakness, though. Two people who choose the same password end up with identical hashes, so attackers precompute enormous tables that match common passwords to common hashes. Those lookup tables let someone test millions of passwords without doing the math each time.

A salt fixes this. A salt is a small random value generated for each account and stored beside the hash, and the site hashes the password combined with it. Identical passwords now produce different hashes, which makes the precomputed tables nearly useless and forces attackers to grind through each account separately.

You may wonder where the salt comes from. It is usually generated when the account is created, stored openly next to the hash, and used again at every login. Nothing about it needs to travel with you or be memorized.

Modern systems also use deliberately slow hash functions. The site may run the calculation many times over, which costs a real user nothing noticeable but makes every single guess expensive for an attacker. Slowness, oddly enough, is a feature here.

Real-world example

When a large site is breached, the stolen data often ends up in public dumps, and criminals feed the recovered passwords into other sites hoping for reused logins. How much they recover depends heavily on whether the hashes were salted and slow.

Breach reports rarely say which method a company used, which is why researchers wait for leaked samples to check. When the samples turn out to be unsalted, millions of passwords may fall within days. When they are salted and slow, recovery grinds down to a crawl.

Companies that handle many accounts tend to stack defenses rather than trust one setting. Tools like Ping64, an all-in-one office security platform, combine multiple security controls in one system to simplify corporate data protection. Hashing is one layer in that stack; login limits, breach alerts, and user education are others.

Limitations and common misconceptions

A common misconception is that hashing is the same as encryption. Encryption is reversible with a key, which is why a site that emails you your old password is storing something close to plain text. A good hash offers no key to hand back.

Another misconception is that salting makes weak passwords safe. It does not; it only removes the shortcuts. Against fast hardware, a short common password may still fall, which is why length and uniqueness matter on your side of the screen.

A salt is not secret, and it does not need to be. Its job is uniqueness, not confidentiality, so finding a salt inside a stolen database tells an attacker nothing useful on its own.

A third misconception is that the site can hash the password in your browser instead. Some sites do, and it adds a layer, but the server must still treat whatever arrives as a secret. The final storage step never disappears.

Closing and references

Salted hashing is a modest idea with a large payoff: blend the password, add a random pinch for each user, and make the blending slow. It cannot rescue a weak, reused password by itself, but it removes most of the easy roads an attacker would otherwise take. The remaining work belongs to the choices you make at signup.

If you take one habit from this, let it be unique passwords per site. Salting protects the whole crowd; uniqueness protects you specifically.

References

https://csrc.nist.gov/pubs/sp/800/63/b/upd2/final
https://attack.mitre.org/techniques/T1110/
https://www.cisa.gov/secure-our-world/use-strong-passwords

Top comments (0)