package irmin
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=964512f77697947a73dd1875c634d6804e98f14167c5aadd3c4f85b5f30ffb53
sha512=d56d3285daa2dd36f1eaff867af5c8f44c61bba4de1a5c7bb5347652dbc460c343483ab61de1a9302f664af357eacc964dc5c8b4477f6d01372dc028b162e98b
doc/irmin.mem/Irmin_mem/KV/Make/Schema/Hash/index.html
Module Schema.Hash
Source
Signature for digest hashes, inspired by Digestif.
Compute a deterministic store key from a sequence of strings.
short_hash h
is a small hash of h
, to be used for instance as the `hash` function of an OCaml Hashtbl
.
hash_size
is the size of hash results, in bytes.
to_raw_string t
is the raw sequence of bytes in t
(of length hash_size
).
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
.
Value Types
t
is the value type for t
.