Performance: Password storage best practices
HIGH IMPACT
This affects server response time during user authentication and overall security of stored passwords.
from werkzeug.security import generate_password_hash # Using strong salted hash password_hash = generate_password_hash('user_password', method='pbkdf2:sha256', salt_length=16)
import hashlib # Using fast hash without salt password_hash = hashlib.md5(b'user_password').hexdigest()
| Pattern | CPU Usage | Blocking | Security | Verdict |
|---|---|---|---|---|
| Fast hash (MD5) without salt | Low | No | Very weak | [X] Bad |
| Plaintext password comparison | Negligible | No | None | [X] Bad |
| Synchronous PBKDF2 hashing | High | Yes | Strong | [!] OK |
| Asynchronous PBKDF2 hashing | High | No | Strong | [OK] Good |