View Source Comeonin.PasswordHash behaviour (Comeonin v5.4.0)

Defines a behaviour for password hashing functions.

Summary

Callbacks

Generates a random salt and then hashes the password.

Checks the password by comparing it with a stored hash.

Types

@type opts() :: keyword()
@type password() :: binary()
@type password_hash() :: binary()

Callbacks

Link to this callback

hash_pwd_salt(password, opts)

View Source
@callback hash_pwd_salt(password(), opts()) :: password_hash()

Generates a random salt and then hashes the password.

Link to this callback

verify_pass(password, password_hash)

View Source
@callback verify_pass(password(), password_hash()) :: boolean()

Checks the password by comparing it with a stored hash.

Please note that the first argument to verify_pass should be the password, and the second argument should be the password hash.