package octez-libs

  1. Overview
  2. Docs

Tezos - Manipulation and creation of hashes

Predefined Hashes

type t
val name : string
val title : string
val pp : Format.formatter -> t -> unit
val pp_short : Format.formatter -> t -> unit
include Tezos_stdlib.Compare.S with type t := t
val (=) : t -> t -> bool

x = y iff compare x y = 0

val (<>) : t -> t -> bool

x <> y iff compare x y <> 0

val (<) : t -> t -> bool

x < y iff compare x y < 0

val (<=) : t -> t -> bool

x <= y iff compare x y <= 0

val (>=) : t -> t -> bool

x >= y iff compare x y >= 0

val (>) : t -> t -> bool

x > y iff compare x y > 0

val compare : t -> t -> int

compare an alias for the functor parameter's compare function

val equal : t -> t -> bool

equal x y iff compare x y = 0

val max : t -> t -> t

max x y is x if x >= y otherwise it is y

val min : t -> t -> t

min x y is x if x <= y otherwise it is y

val hash_bytes : ?key:Bytes.t -> Bytes.t list -> t
val hash_string : ?key:string -> string list -> t

hash_string ?key inputs returns a hash.

Raises an Assert_failure if String.length key > 64.

val zero : t
val size : int
val to_hex : t -> Tezos_stdlib.Hex.t
val of_hex_opt : Tezos_stdlib.Hex.t -> t option
val of_hex_exn : Tezos_stdlib.Hex.t -> t
val to_string : t -> string
val of_string : string -> t Tezos_error_monad.Error_monad.tzresult
val of_string_opt : string -> t option
val of_string_exn : string -> t
val to_bytes : t -> Bytes.t
val of_bytes_opt : Bytes.t -> t option
val of_bytes_exn : Bytes.t -> t

Building Hashes

The parameters for creating a new Hash type using Make_Blake2B. Both name and title are only informative, used in error messages and serializers.

module type Name = sig ... end
module type PrefixedName = sig ... end
module Make_minimal (Name : Name) : sig ... end

Builds a new Hash type using Blake2B.

module type Register = sig ... end
module Make (Register : Register) (Name : PrefixedName) : sig ... end
OCaml

Innovation. Community. Security.