bcrypt vs Argon2 vs SHA-256
Not all hashing algorithms are equal. SHA-256 is fast — and that's a problem for passwords. bcrypt and Argon2 are purpose-built to be slow. Here's what you need to know.
| Feature | bcrypt | Argon2 |
|---|---|---|
| Designed for passwords | Yes — intentionally slow with configurable cost factor. | Yes — winner of Password Hashing Competition (2015). |
| Speed | Slow by design — adjustable work factor. | Slow by design — tunable time, memory, and parallelism. |
| Memory hardness | No — CPU-bound only, vulnerable to GPU attacks. | Yes — memory-hard, resists GPU and ASIC brute-force. |
| Salt built-in | Yes — generates and stores salt automatically. | Yes — salt is part of the output hash. |
| Output format | Self-contained string with algorithm, cost, salt, and hash. | Self-contained string with all parameters. |
| OWASP recommendation | Recommended — use cost factor 10+ (12+ for high security). | Top recommendation — Argon2id variant preferred. |
| Use case | Password hashing — widely supported in all languages. | Password hashing — best choice for new applications. |
bcrypt Pros & Cons
Pros
- Battle-tested since 1999 — proven track record
- Widely supported across all major languages and frameworks
- Self-contained output — easy to store and verify
- Configurable cost factor for future-proofing
Cons
- CPU-bound only — vulnerable to GPU brute-force attacks
- Max password length of 72 bytes (silently truncates longer passwords)
- Argon2 is now preferred for new applications
Argon2 Pros & Cons
Pros
- Memory-hard — resists GPU and ASIC attacks
- Winner of the Password Hashing Competition
- Tunable across time, memory, and parallelism
- OWASP's top recommendation for new applications
- Argon2id variant combines side-channel and GPU resistance
Cons
- Newer — less legacy support than bcrypt
- Slightly more complex to configure correctly
- Not available natively in all environments (requires library)
Verdict
For new applications: use Argon2id — it's the OWASP top recommendation and resists modern GPU attacks through memory hardness. For existing systems using bcrypt: keep it with a cost factor of 12+, it's still secure. Never use SHA-256 (or MD5/SHA-1) alone for passwords — they're too fast and trivially cracked with GPU rigs. Use SHA-256 only for data integrity, digital signatures, and HMACs.