Library
Module
Module type
Parameter
Class
Class type
val empty : t
empty
is the hash of the empty string.
feed t msg
adds the information in msg
to t
.
feed
is analogous to appending: feed (feed t msg1) msg2 = feed t (Cstruct.append msg1 msg2)
.
Functions that operate on data stored in a single chunk.
val digest : Cstruct.t -> digest
digest msg
is the digest of msg
.
digest msg = get (feed empty msg)
val hmac : key:Cstruct.t -> Cstruct.t -> digest
hmac ~key bytes
is the authentication code for bytes
under the secret key
, generated using the standard HMAC construction over this hash algorithm.
Functions that operate on arbitrary iterators. They can serve as a basis for other, more specialized aggregate hashing operations.
These functions are a little faster than using feed
directly.
feedi t iter =
(let r = ref t in iter (fun msg -> r := feed !r msg); !r)