Reading — step 1 of 5
Read
~1 min readVerification & Storage
Rehash on Login
Hardware gets faster. Your bcrypt cost from 2018 may now be too low.
Strategy: when a user logs in:
- Verify their password against the stored hash.
- CHECK if the stored hash uses outdated parameters.
- If yes: rehash with current parameters and update the database.
python
The argon2 library has needs_rehash() checks for memory + iteration parameters.
For users who NEVER log in: their hash stays at the old cost. Periodic forced rehash via password reset (or just accept the residual risk for inactive users).
This is the standard pattern for staying ahead of hardware advancement WITHOUT requiring all users to change passwords.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…