Module B0_std.Hash
Hash values and functions.
The property we want from these functions is speed and collision resistance. Build correctness depends on the latter.
Hash values
type t
The type for hash values. All hash functions use this representation. It is not possible to distinguish them, except for their
length
which might vary, or not.
val length : t -> int
length h
is the length ofh
in bytes.
Predicate and comparisons
Converting
val to_bytes : t -> string
to_bytes h
is the sequence of bytes ofh
.
val of_bytes : string -> t
of_bytes s
is the sequences of bytes ofs
as a hash value.
val to_hex : t -> string
to_hex h
isString.Ascii.to_hex
(to_bytes h)
.
val of_hex : string -> (t, int) Stdlib.result
of_hex s
isResult.map of_bytes (
String.Ascii.of_hex
s)
.
val conv : t Conv.t
conv
converts usingConv.string_bytes
.
Hash functions
module type T = sig ... end
The type for hash functions.
module Murmur3_128 : T
Murmur3_128
is the MurmurHash3 128-bit hash.
module Xxh_64 : T
Xxh_64
is the xxHash 64-bit hash.
val funs : unit -> (module T) list
funs ()
is the list of available hash functions.
val add_fun : (module T) -> unit
add_fun m
addsm
to the list returned byfuns
.