package dirsp-proscript

  1. Overview
  2. Docs

Signature of cryptographic primitives and low-level functions needed by verified ProScript code.

type t

The type that will be used to represent contiguous bytes; typically either Bytes.t or Cstruct.t

type t_elem

The type that will be used to represent a single byte

val equal : t -> t -> bool

equal t_a t_b is true if and only if the buffers t_a and t_b contain the same bytes

val concat : t list -> t

concat b_lst take a list of buffers b_lst, concatenates them together into one buffer

val of_string : string -> t

of_string s converts a string s into a buffer

val of_elem_list : t_elem list -> t

of_elem_list elem_lst concatenates a list of byte elements elem_lst into a buffer

val of_cstruct : Cstruct.t -> t

of_cstruct cs converts a Cstruct cs into a buffer

val to_bytes : t -> Stdlib.Bytes.t

to_bytes b converts a buffer b into Bytes

val elem_at : t -> int -> t_elem

elem_at b i gives the byte element at the zero-based position i of buffer b

val char_of_elem : t_elem -> char

char_of_elem e converts a byte element e to a character (a byte)

val elem_of_char : char -> t_elem

elem_of_char c convert a byte c into a buffer element

val hexdump : t -> unit

hexdump_pp b gives a thunk that pretty-prints the buffer b to standard output

val hexdump_pp : Stdlib.Format.formatter -> t -> unit

hexdump_pp fmt b gives a thunk that pretty-prints the buffer b to the formatter fmt

val t_from_protobuf : Protobuf.Decoder.t -> t

t_from_protobuf d reads the next value from the protobuf decoder d and converts it into a buffer

val t_to_protobuf : t -> Protobuf.Encoder.t -> unit

t_to_protobuf b e creates a thunk which will encode the buffer b with the protobuf encoder e when called

module Encoding : PROSCRIPT_ENCODING with type t = t and type t_elem = t_elem

Conversions back and forth between various encodings like hexadecimal.

module Crypto : PROSCRIPT_CRYPTO with type t = t

Core cryptographic primitives like SHA-256.