31. Hashing Passwords and Sensitive Data
Never store plaintext passwords. Hash them with strong algorithms and salts.
Example using hashlib
import hashlib, os
password = "hunter2".encode("utf-8")
salt = os.urandom(16)
hashed = hashlib.pbkdf2_hmac("sha256", password, salt, 100000)
print("Stored hash:", hashed.hex())
✅ Lesson: Always use salted, iterative hashing for password storage.