Bcryptrs (bcryptrs v0.1.3)

Bcryptrs is a drop in replacement for bcrypt_elixir that does not require C compiler

To use it simply add the dependency to mix.exs and replace every usage of Bcrypt with Bcryptrs

Don't forget to removew bcrypt_elixir from mix.exs and mix.lock

Summary

Functions

Returns a hash of probvided password. Optionally supports also a second argumet which is the cost

Runs hashing alghoritm in constant time. Used to avoid timing attacks against actors that check if an user exist

Verifies if a given password matches the stored hash

Functions

Link to this function

hash_pwd_salt(password)

Returns a hash of probvided password. Optionally supports also a second argumet which is the cost

  hashed_password = Bcryptrs.hash_pwd_salt(password)
Link to this function

hash_pwd_salt(password, cost)

See Bcryptrs.Native.hash_pwd_salt/2.

Link to this function

no_user_verify()

Runs hashing alghoritm in constant time. Used to avoid timing attacks against actors that check if an user exist

case User.get(id) do
  nil -> Bcryptrs.no_user_verify()
  user -> Bcryptrs.verify_password(password, user.hashed_password)
end
Link to this function

no_user_verify(cost)

See Bcryptrs.Native.no_user_verify/1.

Link to this function

verify_pass(password, hash)

Verifies if a given password matches the stored hash

  Bcryptrs.verify_password(password, hashed_password)