type storage = Bytes.t
val of_salt : salt -> storage

of_salt s converts s to storage. The result is salt_size bytes long.

val to_salt : storage -> salt

to_salt s converts s to a salt.

  • raises Size_mismatch

    if s is not salt_size bytes long

val wipe_to_password : storage -> password

wipe_to_password s copies a password s from storage and wipes s.

val hash_password : difficulty -> password -> storage

hash_password d pw uses the key derivation algorithm to create a safely storable hash of the password of size password_hash_size. It randomly generates a salt, and stores the result of the derivation, along with the salt and parameters d, so that verify_password can later verify the hash.

val verify_password_hash : storage -> password -> bool

verify_password_hash h p uses the key derivation algorithm to check that a safely storable password hash h actually matches the password p.