compare h h' is 0 if
h' are equal, a negative integer if
h is less than
h', and a positive integer if
h is greater than
compare is not constant time.
random_key () generates a random secret key of
val derive_key : int -> Password_hash.difficulty -> Password_hash.password -> Password_hash.salt -> secret_key
derive_key key_size difficulty pw salt derives a key of length
key_size from a human generated password. Since the derivation depends on both
salt, it is necessary to store them alongside the hash. Using a constant salt is insecure because it increases the effectiveness of rainbow tables. Generate the salt with a function like
init ?key ?size () is a streaming hash state keyed with
key if supplied and computing a hash of size
copy state is a copy of the
state which can diverge from the original (including finalization).
module type S = sig ... end