Digestif.SHA384val empty : ctxAn empty hash context.
val init : unit -> ctxCreate a new hash state.
feed_bytes msg t adds informations in msg to t. feed is analogous to appending: feed (feed t msg1) msg2 = feed t (append msg1 msg2)
Same as feed_bytes but for String.t.
Same as feed_bytes but for bigstring.
feedi_bytes t iter = let r = ref t in iter (fun msg -> r := feed !r msg); !r
digest_bytes msg is the digest of msg.
digest_bytes msg = get (feed_bytes empty msg).
Same as digest_bytes but for a String.t.
Same as digest_bytes but for a bigstring.
Same as digesti_bytes but for String.t.
Same as digesti_bigstring but for bigstring.
Specialization of digesti_bytes with a list of Bytes.t (see iter).
Same as digestv_bytes but for String.t.
Same as digestv_bytes but for bigstring.
hmac_bytes ~key bytes is the authentication code for Bytes.t under the secret key, generated using the standard HMAC construction over this hash algorithm.
Same as hmac_bytes but for String.t.
Same as hmac_bytes but for bigstring.
Authentication code under the secret key over a collection of Bytes.t.
Specialization of hmaci_bytes with a list of Bytes.t (see iter).
Same as hmacv_bytes but for String.t.
Same as hmacv_bigstring but for bigstring.
unsafe_compare function returns 0 on equality and a negative/positive int depending on the difference (like String.compare). However, this behavior is dangerous since sorting by these hashes can allow attackers to infer information about them.
compare a b uses caml_hash (murmur3) to get an unique integer of a and b a do a substraction on them. Order is not lexicographical. The safety relies on the assumption that the murmur3 seed cannot be reconstructed by an attacker.
About safety, t is private string and let the user to define its own compare function.
val of_hex : string -> tof_hex tries to parse an hexadecimal representation of t. of_hex raises an invalid_argument when input is malformed. We take only firsts digest_size hexadecimal values and ignore rest of input. If it has not enough hexadecimal values, trailing values of the output hash are zero (\x00),
val consistent_of_hex : string -> tconsistent_of_hex tries to parse an hexadecimal representation of t. consistent_of_hex raises an invalid_argument when input is malformed. However, instead of_hex, consistent_of_hex expects exactly digest_size hexadecimal values (but continues to ignore whitespaces).