1 Why MD5 and SHA1 Fail for Passwords
MD5 and SHA1 are general-purpose cryptographic hash functions designed for speed. This speed is catastrophic for password storage — modern GPUs can compute billions of MD5 hashes per second, making offline brute-force trivial.
Vulnerable storage (Python):
import hashlib
# NEVER do this for passwords
hashed = hashlib.md5(password.encode()).hexdigest()
hashed = hashlib.sha256(password.encode()).hexdigest() # Still wrong!Why rainbow tables make it worse: Unsalted hashes are vulnerable to precomputed rainbow tables. An attacker who obtains the database can look up millions of common password hashes instantly — no cracking needed.
Speed comparison:
- MD5: ~10 billion hashes/second on a consumer GPU
- SHA-256: ~2 billion hashes/second
- bcrypt (cost 12): ~100 hashes/second
- argon2id: ~10 hashes/second (configurable)
The 100-million-fold slowdown from bcrypt makes offline brute-force impractical even after a database breach.