Websites keep passwords secure by never storing the actual password. Instead, they transform it through a one-way mathematical process called hashing, add a unique random value called a salt, and then store only that result. When you log in, the site repeats the process on what you type and compares the two hashes—if they match, you’re in.
The Problem: Why Plain Text Is a Disaster
Imagine a website stored your password as “MyDogRex123” in a database. If an attacker breaks in—through a SQL injection, a leaked backup, or a rogue employee—they instantly have your password. Since most people reuse passwords, that one breach exposes their email, bank, and social media accounts. Even in the early 2000s, major companies stored plain text, and the fallout was enormous. The industry learned the hard way that passwords must never be recoverable from the server’s data.
Hashing: The One-Way Street
A hash function takes any input (like a password) and produces a fixed-length string of characters. The key property is that it’s one-way: you can’t reverse it to get the original password. For example, the SHA-256 hash of “password” is always:
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
But even a tiny change—”Password” with a capital P—produces a completely different hash. When you log in, the site hashes what you type and compares it to the stored hash. If they match, the password is correct. The actual password never travels in plain text (it’s sent over HTTPS, but that’s a separate layer).
Salting: Making Each Hash Unique
Hashing alone isn’t enough. If two users have the same password, they get the same hash. Attackers use precomputed tables (rainbow tables) that map common passwords to their hashes, making cracking trivial. To defeat this, websites add a salt—a random string unique to each user—before hashing. For example:
- User A’s password “hello” + salt “x9f2” → hash1
- User B’s password “hello” + salt “k3m8” → hash2
Now identical passwords produce different hashes. The salt is stored alongside the hash, but it’s not secret—it just makes precomputed attacks useless. Even if an attacker gets the salt, they’d have to crack each hash individually.
Slow Hashing Algorithms: The Arms Race
Fast hashes like MD5 or SHA-256 are designed for speed, which is exactly what attackers want. A GPU can try billions of guesses per second. So modern websites use slow, memory-hard algorithms that are deliberately expensive to compute. Common ones include:
- bcrypt – uses the Blowfish cipher, adjustable cost factor
- scrypt – requires a lot of memory, making parallel attacks hard
- Argon2 – winner of the Password Hashing Competition, resistant to GPU cracking
These algorithms take about 100–200 milliseconds per hash on a normal server. That’s imperceptible to you, but it slows an attacker to a crawl—cracking a single bcrypt hash with a common password might take minutes instead of microseconds.
Additional Layers: Peppers, HTTPS, and Rate Limiting
Beyond hashing and salting, sites add more defenses:
- Pepper: a secret key stored separately (e.g., in environment variables) that’s mixed into the hash. Even if the database leaks, the pepper is not with it, making offline cracking impossible without also compromising the server.
- HTTPS: encrypts the password in transit, so it can’t be sniffed on the network.
- Rate limiting: limits login attempts (e.g., 5 per minute) to prevent brute-force guessing.
- Multi-factor authentication (MFA): adds a second check (like a code from your phone) so a stolen password alone isn’t enough.
What About Password Managers and Breach Notifications?
Password managers generate and store strong, unique passwords for each site. They encrypt your vault with a master password, which is itself hashed and salted. When a site is breached, responsible companies notify users and force password resets. They also use services like Have I Been Pwned to check if your credentials appear in known leaks. However, the security of a password ultimately depends on the site’s implementation—some still use outdated methods.
How to Choose a Strong Password (and Why It Matters)
Even with perfect hashing, weak passwords are vulnerable to dictionary attacks. A password like “123456” will be cracked in seconds regardless of the algorithm. To protect yourself:
- Use a passphrase of 4–5 random words (e.g., “correct horse battery staple”)—it’s long and memorable.
- Never reuse passwords across sites; a breach on one site compromises all.
- Use a password manager to generate and store random strings.
- Enable MFA wherever possible.
Frequently Asked Questions
Can websites recover my password if I forget it?
No, because they don’t store it. Instead, they send a password reset link (which expires quickly) or a temporary code. That’s why you can’t just ask support to tell you your old password—they can only reset it.
Is it safe to let my browser save passwords?
Modern browsers encrypt saved passwords with your OS’s keychain (Windows Hello, macOS Keychain, etc.). It’s generally safer than reusing the same password everywhere, but a determined attacker with local access could still extract them. A dedicated password manager offers more control.
What happens if a website stores passwords in plain text?
It’s a critical vulnerability. If breached, attackers get every password instantly. Many users then lose accounts on other sites due to reuse. You should change your password immediately and consider using a unique one for that site.
Why do some sites still use MD5 or SHA-1?
Legacy systems often have outdated code. MD5 and SHA-1 are fast and cryptographically broken for this purpose—they can be cracked in seconds with modern hardware. If a site uses them, it’s a red flag about its security posture.
How do hackers crack passwords if they’re hashed?
They guess passwords, hash each guess (with the salt), and compare. They use dictionaries of common passwords, variations, and leaked password lists. Slow hashing makes this process so slow that it’s impractical for strong passwords.
Does using a VPN make my passwords more secure?
No, a VPN only hides your IP address and encrypts traffic between you and the VPN server. It doesn’t affect how the website stores your password. HTTPS already encrypts the password in transit, so a VPN adds little for this specific concern.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Valheim Server Not Showing in Community List Fixes
- DisplayPort vs HDMI: Which Cable Should You Use?
- Soundbar vs 2.1 Speaker System: Which Is Better?
- Survive Lava for Brainrot Tier List170 points
- MySQL Dump Import: Fix Common Errors
- Mouse Moving on Its Own? Causes & Fixes