Module Base__Hash
module type Full = sig ... end
module type S = sig ... end
module F : functor (Hash : S) -> Full with type hash_value = Hash.hash_value and type state = Hash.state and type seed = Hash.seed
include Full with type state = Base_internalhash_types.state and type seed = Base_internalhash_types.seed and type hash_value = Base_internalhash_types.hash_value
val run : ?seed:seed -> 'a folder -> 'a -> hash_value
run ?seed folder x
runsfolder
onx
in a newly allocated hash-state, initialized using optionalseed
or a default-seed.The following identity exists:
run [%hash_fold: T]
==[%hash: T]
run
can be used if we wish to run a hash-folder with a non-default seed.
module Builtin : sig ... end
val of_fold : (state -> 'a -> state) -> 'a -> hash_value
of_fold fold
constructs a standard hash function from an existing fold function.
val create : ?seed:seed -> unit -> state
create ?seed ()
is a convenience. Equivalent toreset ?seed (alloc ())
.
type state
= Base_internalhash_types.state
state
is the internal hash-state used by the hash function.
val fold_int : state -> int -> state
fold_<T> state v
incorporates a valuev
of type <T> into the hash-state, returning a modified hash-state. Implementations of thefold_<T>
functions may mutate thestate
argument in place, and return a reference to it. Implementations of the fold_<T> functions should not allocate.
val fold_int64 : state -> int64 -> state
val fold_float : state -> float -> state
val fold_string : state -> string -> state
type seed
= Base_internalhash_types.seed
seed
is the type used to seed the initial hash-state.
val alloc : unit -> state
alloc ()
returns a fresh uninitialized hash-state. May allocate.
val reset : ?seed:seed -> state -> state
reset ?seed state
initializes/resets a hash-state with the givenseed
, or else a default-seed. Argumentstate
may be mutated. Should not allocate.
type hash_value
= Base_internalhash_types.hash_value
hash_value
The type of hash values, returned byget_hash_value
.
val get_hash_value : state -> hash_value
get_hash_value
extracts a hash-value from the hash-state.
module For_tests : sig ... end