Module for safe salting and hashing of passwords using the Bcrypt algorithm.
exception Invalid_count of
count is invalid. The
count must be an integer between
4 and 31, inclusive.
exception Invalid_seed of
The given string
seed cannot be used as seed. Please provide a string
at least 16 bytes long.
exception Urandom_error of
An exception occurred obtaining random seed from
An exception occurred in backend's
An exception ocurred in backend's
Abstract type holding a password in salted and hashed form. Use function
to generate a hash.
Public functions and values
val hash :
?count:int -> ?seed:string -> string -> hash
hash ?count ?seed password to hash the given password string. The
password is automatically salted before hashing. If
seed is not given,
the salting procedure automatically fetches a seed from
seed must be a string at least 16 bytes long. The
parameter is the log2 number of Blowfish iterations to use in the
hashing procedure. Its default value is 6, and any integer between 4
and 31 (inclusive) may be used.
val verify :
string -> hash -> bool
verify password hash to verify if the given password matches the
previously hashed password.
val hash_of_string :
string -> hash
val string_of_hash :
hash -> string