package git

  1. Overview
  2. Docs

Parameters

module D : DIGEST

Signature

Arrays of hashes

Similar to Cstruct.t but where the unit of offsets and length is the number of hash values instead of the number of bytes.

val get : Cstruct.t -> int -> t

get buf n is the n-th hash in the buffer buf.

val sub : Cstruct.t -> int -> int -> Cstruct.t

Same as Cstruct.sub but where offset and length as hash offsets.

val to_list : Cstruct.t -> t list

to_list t is the list of elements of t.

val length : Cstruct.t -> int

length v is the number of hashes store in t.

linear_search buf h iterates through the hashes stored in the buffer buf. Return the indice of the first hash equals to h. Can raise Ambiguous if h is short and more than one hash are similar.

binary_search buf h binary searches through the sorted array of hashes stored in buf. Return the indice of the first hash equal to h. Can raise Ambiguous if h is short and more than one hash are similar.

OCaml

Innovation. Community. Security.