Sigra.Hashers.Bcrypt (Sigra v1.20.0)

Copy Markdown View Source

Bcrypt password hasher for migration from bcrypt to Argon2id.

This module implements the Sigra.Hasher behaviour using bcrypt_elixir. It is intended for transparent hash migration: when a user logs in with a bcrypt-hashed password, it is verified and then re-hashed with Argon2id.

bcrypt_elixir is an optional dependency. If it is not loaded, calling hash_password/1 or verify_password/2 will raise a descriptive error. The no_user_verify/0 function gracefully falls back to Argon2 timing when bcrypt is unavailable.

Installation

Add to your mix.exs dependencies:

{:bcrypt_elixir, "~> 3.3"}