Authors: Fred Hebert (mononcqc@gmail.com) [web site: http://ferd.ca/].
hash() = binary()
The hashed password with a given work factor.
password() = iodata()
A password, supports valid unicode.
work_factor() = 4..31
Work factor of the bcrypt algorithm.
| change/3 | If a given password matches a given hash, the password is re-hashed again using the new work factor. |
| change/4 | If a given old password matches a given old hash, a new password is hashed using the work factor passed in as an argument. |
| hash/1 | Similar to hash(Password, 12). |
| hash/2 | Hashes a given password with a given
work factor. |
| match/2 | Compares a given password to a hash. |
change(Pass::password(), Hash::hash(), Factor::work_factor()) -> hash() | {error, bad_password}
Equivalent to change(Pass, Hash, Pass, Factor).
If a given password matches a given hash, the password is re-hashed again using the new work factor. This allows to update a given work factor to something stronger.
change(OldPass::password(), Hash::hash(), NewPass::password(), Factor::work_factor()) -> hash() | {error, bad_password}
If a given old password matches a given old hash, a new password is hashed using the work factor passed in as an argument. Allows to safely change a password, only if the previous one was given with it.
hash(S::password()) -> hash()
Similar to hash(Password, 12).
hash(Str::password(), Factor::work_factor()) -> hash()
Hashes a given password with a given
work factor. Bcrypt will be used to create
a hash of the password to be stored by the application.
Compare the password to the hash by using match/2.
Bcrypt takes care of salting the hashes for you so this does not need to be
done. The higher the work factor, the longer the password will take to be
hashed and checked.
match(Pass::password(), Hash::hash()) -> boolean()
Compares a given password to a hash. Returns true if
the password matches, and false otherwise. The comparison
is done in constant time (based on the hash length)
Generated by EDoc