Hash Generator - MD5, SHA-256, SHA-512
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes for text and files. Check malware hashes with VirusTotal integration.
Open the full Hash Generator - MD5, SHA-256, SHA-512 tool →The Dangerous Misconception About Password Hashing
Never use MD5 or SHA-256 to hash passwords: they are general-purpose hash functions built to be fast, and speed is exactly the property you do not want in a password hash. An attacker who steals a database of SHA-256 password hashes can test guesses rapidly offline, even when every password has a unique salt. Passwords require a deliberately slow, salted, and ideally memory-hard algorithm designed for the job: Argon2id (preferred), or scrypt, bcrypt, or PBKDF2. (MD5 has the additional problem of being cryptographically broken, but for passwords the fatal flaw of both MD5 and SHA-256 is raw speed.)
That is the summary an AI Overview will give you. What it can't give you is the why behind the speed problem, a side-by-side comparison of the real algorithms, and the migration playbook for fixing a system that already got this wrong — which is what the rest of this guide covers.
The confusion stems from a fundamental misunderstanding: while MD5 and SHA-256 are hash functions, they are completely unsuitable for password storage. Using them for passwords is like using a sports car to haul freight—the tool is completely mismatched to the task, and the consequences of that mismatch can be devastating.
In this comprehensive guide, we'll explore exactly why general-purpose hash functions fail spectacularly for passwords, examine the specialized algorithms designed specifically for password storage, and provide actionable guidance for implementing secure password systems.
Why Speed Is Your Enemy in Password Hashing
General-purpose cryptographic hash functions like MD5 and SHA-256 were explicitly designed to be fast. For their intended use cases—verifying file integrity, creating digital signatures, generating checksums—speed is a desirable property. A hash function that takes seconds to compute would be impractical for these applications where millions of hashes might need to be calculated.
However, this design goal becomes a catastrophic vulnerability when applied to password storage. Attackers with a stolen database can test guesses rapidly because general-purpose hashes are inexpensive to compute.
For a stolen password database, a fast hash lets an attacker try many guesses offline. The time to recover a password also depends heavily on how predictable the password is.
Beyond brute-force speed, general-purpose hash functions suffer from another critical vulnerability when used for passwords: rainbow table attacks. Rainbow tables are precomputed databases mapping common passwords to their hash values. Because hash functions are deterministic (the same input always produces the same output), attackers can build massive lookup tables offline and then instantly "crack" passwords by looking up their hashes.
For example, if your database stores SHA-256 hashes and an attacker finds the hash 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8, they can instantly look it up in a rainbow table to discover it represents the password "password". No computation is required—just a database lookup taking milliseconds.
Precomputed hash lists can help attackers identify common unsalted passwords without recomputing each candidate.
The Inadequacy of Simple Salting
The traditional defense against rainbow tables is salting—adding a unique random string to each password before hashing. A salted password might be hashed as SHA-256(password + random_salt), where each user gets a different random salt stored alongside their hash. This prevents rainbow table attacks because attackers would need separate tables for every possible salt value, which is computationally infeasible.
However, salting alone doesn't solve the fundamental speed problem. While it prevents pre-computation attacks, it does nothing to slow down brute-force attacks against a specific stolen password database. Attackers simply include the salt (which must be stored alongside the hash) when computing their guesses: SHA-256(guess + known_salt).
Since SHA-256 remains blazingly fast even with salting, attackers can still test password combinations rapidly. Salting merely prevents rainbow tables; it doesn't address the core vulnerability of excessive computational speed. For effective password security, you need algorithms specifically designed to be slow and resistant to hardware acceleration.
Password-Specific Hashing Algorithms
Recognizing these fundamental limitations, cryptographers developed specialized password hashing algorithms engineered specifically for credential storage. The table below is the fastest way to see why the general-purpose hashes lose and which purpose-built function to reach for.
| Algorithm | Speed on GPU | Built-in salt | Memory-hard | Adaptive cost | Use for passwords? |
|---|---|---|---|---|---|
| MD5 | Fast (also collision-broken) | No | No | No | Never |
| SHA-256 | Fast | No | No | No | Never |
| SHA-512 | Fast | No | No | No | Never |
| PBKDF2 | Depends on cost settings | Yes | No | Yes (iterations) | Only if FIPS-required |
| bcrypt | Depends on cost settings | Yes | No | Yes (work factor) | OK for legacy / existing systems |
| scrypt | Depends on cost settings | Yes | Yes | Yes (N, r, p) | Good; strong memory-hard option |
| Argon2id | Depends on cost settings | Yes | Yes | Yes (memory, time, parallelism) | Preferred — use this for new systems |
How to read this: the top three are fast general-purpose hashes and are disqualified outright — never store passwords with them. Among the real password hashes, memory-hardness (scrypt, Argon2id) is what defeats the GPU/ASIC farms attackers actually use, which is why Argon2id is the modern default. PBKDF2 lacks memory-hardness and is the weakest of the acceptable options; choose it only when a compliance regime such as FIPS 140 mandates it.
These purpose-built algorithms incorporate multiple security features that general-purpose hash functions lack: adaptive cost factors that can be increased over time as hardware improves, built-in salting to prevent rainbow table attacks without additional code, and memory-hard designs that resist GPU and ASIC acceleration. These algorithms incorporate multiple security features that general-purpose hash functions lack: adaptive cost factors that can be increased over time as hardware improves, built-in salting to prevent rainbow table attacks without additional code, and memory-hard designs that resist GPU and ASIC acceleration.
Argon2: The Modern Standard
Argon2, winner of the Password Hashing Competition in 2015, represents the current state-of-the-art for password hashing. It comes in three variants: Argon2d (resistant to GPU cracking attacks), Argon2i (resistant to side-channel timing attacks), and Argon2id (hybrid approach recommended for most applications).
Argon2's security derives from its memory-hard design. Unlike SHA-256, which requires minimal memory, Argon2 forces attackers to allocate substantial RAM for each hash computation. One recommended configuration uses 46 MiB of memory per hash with one iteration, or 19 MiB with two iterations. This memory requirement raises the cost of parallel cracking attempts.
The cost parameters can be tuned based on your system's capabilities and security requirements. A web application might configure Argon2 to take 50-100 milliseconds per hash—slow enough to resist brute-force attacks but fast enough that legitimate users don't experience noticeable delays during login. As hardware improves over the years, you can increase the memory and time costs to maintain security without changing your code structure.
Bcrypt: The Proven Legacy Option
Bcrypt, developed in 1999, remains a solid choice for password hashing despite its age. It uses the Blowfish cipher in a computationally expensive key derivation process, with a configurable work factor controlling computation time. Each increment in the work factor doubles the computation time, providing built-in adaptability to hardware improvements.
Choose a bcrypt work factor based on your performance budget and current guidance. Bcrypt automatically handles salting, generating unique random salts for each password without additional code.
Many bcrypt implementations use only the first 72 bytes of input; bytes and characters are not the same for non-ASCII passwords. Check the library's behavior and apply a consistent length policy. Despite this limitation, bcrypt's 25+ year track record of security makes it suitable for legacy systems where Argon2 isn't available, provided you implement proper password length validation.
Scrypt: The Memory-Hard Alternative
Scrypt, designed by Colin Percival in 2009, was one of the first memory-hard algorithms and remains relevant for specific use cases. Like Argon2, scrypt requires substantial memory for computation, making GPU and ASIC attacks significantly more expensive than CPU-based attacks. However, Argon2's superior flexibility and security analysis make it the preferred choice for new implementations.
Scrypt finds its niche in cryptocurrency applications and scenarios where legacy compatibility requires alternatives to bcrypt. Its configurable parameters (N, r, p) control CPU cost, memory cost, and parallelization, allowing fine-tuned performance characteristics. However, parameter selection is more complex than Argon2's straightforward configuration, increasing the risk of misconfiguration.
Real-World Consequences of Incorrect Password Hashing
The theoretical vulnerabilities of using fast hashes for passwords can become real when a stolen database is attacked offline. A unique salt blocks reused precomputed hash tables, while a dedicated password hashing function raises the cost of each guess.
How Attackers Crack Passwords at Scale
Attackers commonly try frequent passwords, dictionary words, and predictable variations before exhaustive guessing. The rate varies by hardware and password hashing configuration. Login rate limits do not stop offline guessing against a stolen hash database.
Implementing Secure Password Storage
Implementing proper password hashing requires following current best practices throughout your authentication system. For new applications, use Argon2id with memory cost of 46 MiB, time cost of 1, and parallelism of 1. Adjust these parameters based on your performance requirements while maintaining at least 50 milliseconds per hash to resist brute-force attacks.
For legacy systems currently using bcrypt, continue using it with work factor 10 or higher—no need to migrate if properly configured. However, systems using MD5, SHA-1, SHA-256, or other inappropriate algorithms require immediate migration. Implement a gradual migration strategy: on each successful login, re-hash the password with Argon2 and update the database, maintaining old hashes until users next log in.
Always use established cryptographic libraries rather than implementing hashing yourself. Use libsodium (includes Argon2), bcrypt library for your language, or platform-native crypto APIs that undergo extensive security auditing. Never truncate passwords before hashing (except bcrypt's inherent limit), as this reduces entropy and weakens security.
Implement proper error handling that fails secure. If hashing fails due to insufficient memory or other errors, reject the authentication attempt rather than falling back to weaker algorithms. Log such failures for investigation but never proceed with compromised security.
Additional Defense Layers
Password hashing is crucial but insufficient alone. Implement rate limiting on authentication endpoints to prevent rapid-fire guess attempts, allowing perhaps 5-10 failed login attempts per account per hour. Use account lockout or CAPTCHA after repeated failures to frustrate automated attacks.
Implement multi-factor authentication (MFA) for sensitive accounts, providing security even if passwords are compromised. MFA dramatically reduces credential-stuffing attack effectiveness because stolen passwords alone cannot access accounts. Mandate MFA for administrative accounts and strongly encourage it for all users.
Monitor for credential stuffing attacks by detecting login attempts using credentials from known breaches. Services like HaveIBeenPwned provide APIs allowing you to check passwords against known compromised credentials. Warn users when they choose passwords appearing in breach databases, encouraging them to select unique passwords not reused from other sites.
Curious how long different passwords would survive an attacker's guessing run? Try the interactive checker below — it estimates strength and crack time entirely in your browser, nothing is transmitted.
Password Strength Checker
Check how strong your password is with entropy analysis, crack time estimates, and breach database checks via Have I Been Pwned. 100% client-side.
Open the full Password Strength Checker tool →The Bottom Line: Use the Right Tool for the Job
MD5, SHA-256, and other general-purpose hash functions are excellent tools for their intended purposes—file integrity, digital signatures, checksum verification. They are catastrophically inappropriate for password storage because their speed enables attackers to test password guesses rapidly after breaching your database.
Password hashing requires specialized algorithms intentionally designed to be slow, memory-intensive, and resistant to hardware acceleration. Argon2id represents the current best practice for new systems, while bcrypt remains acceptable for legacy implementations. Never, under any circumstances, use MD5, SHA-1, SHA-256, SHA-512, or any other fast hash function for passwords.
Secure Your Authentication Systems
Understanding password hashing theory is essential, but proper implementation requires expertise and ongoing vigilance. Experiment with our Hash Generator tool to see the difference between fast hash functions and password-specific algorithms, but remember that production implementations require robust security practices.
Our security team specializes in authentication system audits, identifying and remediating weak password storage implementations before they lead to breaches. We can review your current authentication architecture, implement proper password hashing with Argon2 or bcrypt, and establish secure credential management practices aligned with current best practices and regulatory requirements. Don't wait for a breach to discover your password storage is inadequate—contact us today for a comprehensive security assessment.


