package multihash

  1. Overview
  2. Docs

Parameters

module H : sig ... end

Signature

type 'repr t

The type for multihashes

v hash length digest constructs a new multihash. No checks are made at all on the user-supplied information.

val of_cstruct : Multicodec.multihash -> Cstruct.t -> (Cstruct.t t, [ `Unsupported | `Msg of string ]) Stdlib.result

of_cstruct hash s constructs a multihash for s using hashing strategy hash.

val of_string : Multicodec.multihash -> string -> (string t, [ `Unsupported | `Msg of string ]) Stdlib.result

Same as of_cstruct only using string.

val iter_cstruct : Multicodec.multihash -> ((Cstruct.t -> unit) -> unit) -> (Cstruct.t t, [ `Unsupported | `Msg of string ]) Stdlib.result

Like of_cstruct but we digest the value using the iterator function.

val iter_string : Multicodec.multihash -> ((string -> unit) -> unit) -> (string t, [ `Unsupported | `Msg of string ]) Stdlib.result

Like of_string but we digest the value using the iterator function.

val is_supported : Multicodec.multihash -> bool

Whether this particular multihash library supported a given hash implementation.

val get_hash : _ t -> Multicodec.multihash

get_hash v returns the hashing stategy used for this particular multihash.

val get_length : _ t -> int

The length of the digest.

val get_digest : 'a t -> 'a

The hash digest.

val write : 'a t -> 'a

write v returns a buffer filled with the multihash value.

val read_buff : Cstruct.t -> (Cstruct.t t, [ `Msg of string ]) Stdlib.result

read buf tries to read a multihash from the buffer buf.

val read_string : string -> (string t, [ `Msg of string ]) Stdlib.result

Like read_buff but for strings.

val pp : Stdlib.Format.formatter -> 'a t -> unit

pp ppf v pretty prints a multihash in human-readable format.

val equal : 'a t -> 'a t -> bool

equal a b tests if two multihashes are equal.

module Conv : sig ... end