Context.Hash
include Irmin.Hash.S
val hash : ((string -> unit) -> unit) -> t
Compute a deterministic store key from a sequence of strings.
val short_hash : t -> int
short_hash h
is a small hash of h
, to be used for instance as the `hash` function of an OCaml Hashtbl
.
val unsafe_of_raw_string : string -> t
unsafe_of_raw_string b
is the hash consisting of the raw sequence of bytes b
.
Warning: this function cannot guarantee that the supplied byte string is a valid output of the hash process, so should only be used on strings that are known to have been built with to_raw_string
.
short_hash_substring t off
computes the short-hash of the raw hash data contained in t
at offset off
. It has behaviour equivalent to:
Bigstringaf.substring t ~off ~len:hash_size
|> unsafe_of_raw_string
|> short_hash
but may be more efficient due to not needing to allocate an intermediate string
.
val t : t Irmin.Type.t
t
is the value type for t
.
val to_raw_string : t -> string
val to_context_hash : t -> Mavryk_base.TzPervasives.Context_hash.t
val of_context_hash : Mavryk_base.TzPervasives.Context_hash.t -> t