Storing Passwords Securely
Passwords must never be stored in plaintext or with fast hashes (MD5, SHA-1). Use slow, salted algorithms.
Recommended Algorithms (2026)
Argon2id, bcrypt, scrypt, PBKDF2.
# Python with bcrypt
import bcrypt
h = bcrypt.hashpw(b"password", bcrypt.gensalt())
ok = bcrypt.checkpw(b"password", h)
Why Salt?
A salt is a random per-password value prepended before hashing. It prevents rainbow table attacks and identical passwords produce different hashes.
Additional Measures
Rate limiting on login, two-factor authentication, lockout after failed attempts.
Related: Firewall Basics · Backup Strategy