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.
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 of h
in bytes.
val to_binary_string : t -> string
to_binary_string h
is the sequence of bytes of h
.
val of_binary_string : string -> t
of_binary_string s
is the sequences of bytes of s
as a hash value.
val to_hex : t -> string
to_hex h
is String.Ascii.to_hex
(to_bytes h)
.
val of_hex : string -> (t, string) Stdlib.result
of_hex s
is Result.map of_binary_string (
String.Ascii.of_hex
s)
.
val of_hex' : string -> (t, int) Stdlib.result
of_hex s
is Result.map of_binary_string (
String.Ascii.of_hex'
s)
.
module type T = sig ... end
The type for hash functions.
Xxh3_64
is the xxHash3 64-bit hash.
Xxh3_128
is the xxHash3 128-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
adds m
to the list returned by funs
.
val get_fun : string -> ((module T), string) Stdlib.result
get_fun id
is the hash function with identifier id
or an error message.