package plebeia

  1. Overview
  2. Docs

Module Plebeia.HashSource

1 The first half 224bit/28byte part of node hash.

2 The type

Sourcetype t = private string

Type for the hash. 28 bytes

Sourceval zero : t

28 bytes of 0's

2 Printer and parser

Sourceval to_string : t -> string

Returns a binary string representation of hash

Sourceval of_string : string -> t

Create a hash from 28 bytes binary string. String with an invalid length raises Assert_failure

Sourceval to_hex : t -> Hex.t
Sourceval to_hex_string : t -> string
Sourceval of_hex : Hex.t -> t

Create a hash from a hexiadecimal representation of 28 bytes binary string. Input with an invalid length raises Assert_failure

Sourceval encoding : t Data_encoding.t

Data encoding

2 Hash computation

Sourceval hash : string -> t

Compute the hash of the given binary string

Sourceval hash_list : string list -> t

Compute the hash of the concatenation of the given binary strings

2 Manipulation

Sourceval set_last_2bits : int -> t -> t

set the last 2 bits of the hash to the given integer

Sourceval test : unit -> unit

check the correctness of blake2b