python
10 lines · 1 tab
Kai Nakamura
Apr 2026
1 tab
from argon2 import PasswordHasher
password_hasher = PasswordHasher(
time_cost=3,
memory_cost=65536,
parallelism=4,
)
password_hash = password_hasher.hash('correct horse battery staple')
password_hasher.verify(password_hash, 'correct horse battery staple')
1 file · python
Explain with highlit
Passwords should never be encrypted for later recovery. I store slow one-way hashes, tune work factors for current hardware, and maintain a rehash path when users log in with older credentials. Argon2id is my first choice for new systems, while bcrypt remains a strong practical baseline.
Share this code
Here's the card — post it anywhere.