package sodium
Module Sodium.Generichash
compare h h' is 0 if h and h' are equal, a negative integer if h is less than h', and a positive integer if h is greater than h'. compare is not constant time.
random_key () generates a random secret key of key_size_default bytes.
val derive_key :
int ->
Password_hash.difficulty ->
Password_hash.password ->
Password_hash.salt ->
secret_keyderive_key key_size difficulty pw salt derives a key of length key_size from a human generated password. Since the derivation depends on both difficulty and 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 Password_hash.random_salt instead.
init ?key ?size () is a streaming hash state keyed with key if supplied and computing a hash of size size (default size_default).
copy state is a copy of the state state which can diverge from the original (including finalization).
module type S = sig ... end