View Source AshAuthentication.BcryptProvider (ash_authentication v3.10.7)
Provides the default implementation of AshAuthentication.HashProvider
using Bcrypt
.
Link to this section Summary
Link to this section Functions
Given some user input as a string, convert it into it's hashed form using Bcrypt
.
example
Example
iex> {:ok, hashed} = hash("Marty McFly")
...> String.starts_with?(hashed, "$2b$04$")
true
@spec simulate() :: false
Simulate a password check to help avoid timing attacks.
example
Example
iex> simulate()
false
Check if the user input matches the hash.
example
Example
iex> valid?("Marty McFly", "$2b$04$qgacrnrAJz8aPwaVQiGJn.PvryldV.NfOSYYvF/CZAGgMvvzhIE7S")
true