1 Weak Hashing Algorithms — MD5 and SHA-1 for Passwords
Cryptographic failures (OWASP Top 10 #2) cover a wide range of mistakes: using broken algorithms, insufficient key lengths, storing sensitive data unencrypted, and using cryptography incorrectly. Password hashing is the most common failure point.
The broken approach:
import hashlib
def hash_password(password: str) -> str:
# CRITICALLY WRONG — MD5 is a fast general-purpose hash, not a password hash
return hashlib.md5(password.encode()).hexdigest()
def hash_password_v2(password: str) -> str:
# STILL WRONG — SHA-1 and SHA-256 are also fast hashes, not designed for passwords
return hashlib.sha256(password.encode()).hexdigest()
Why fast hashes are wrong for passwords:
- MD5 can compute ~10 billion hashes per second on a modern GPU
- SHA-256 can compute ~3 billion hashes per second on a modern GPU
- A 6-character password hash can be cracked in under a second
- Rainbow tables precompute hashes for common passwords — no salt means instant lookup
- MD5 has been cryptographically broken since 2004 — hash collisions are trivially generated
Real breach impact: When LinkedIn leaked 117 million SHA-1 password hashes in 2012, 90% were cracked within 3 days using GPU clusters and rainbow tables.