Krug.HashUtil (Krug v0.1.0) View Source
Utilitary module to handle Bcrypt hashes. Useful for store and compare on more secure forms passwords.
Link to this section Summary
Functions
Makes a password hash
to improve a better security on storage.
Compares a clean text string password
whit a string hashed password
and verify if one matches another.
Link to this section Functions
Makes a password hash
to improve a better security on storage.
If nil/empty password received return a empty string.
Example
iex > password = "123456"
iex > Krug.HashUtil.hashPassword(password)
$2b$10$y9nOBmx.kJV3juLBivaixuWMpIoB7ctGREqqrwvvgbqprY/BIRDX6
Compares a clean text string password
whit a string hashed password
and verify if one matches another.
If hashedPassword or password is nil/empty, return false.
Example
iex > password = "123456"
iex > hashedPassword = "$2b$10$y9nOBmx.kJV3juLBivaixuWMpIoB7ctGREqqrwvvgbqprY/BIRDX6"
iex > Krug.HashUtil.passwordMatch(hashedPassword,password)
true (or false if not matches)