Module Dirsp_proscript_mirage.Make
Make a Proscript runtime that uses the mirage-crypto libraries
Parameters
Signature
type t
The type that will be used to represent contiguous bytes; typically either Bytes.t or Cstruct.t
val equal : t -> t -> bool
equal t_a t_b
is true if and only if the bufferst_a
andt_b
contain the same bytes
val concat : t list -> t
concat b_lst
take a list of buffersb_lst
, concatenates them together into one buffer
val of_string : string -> t
of_string s
converts a strings
into a buffer
val of_elem_list : t_elem list -> t
of_elem_list elem_lst
concatenates a list of byte elementselem_lst
into a buffer
val of_cstruct : Cstruct.t -> t
of_cstruct cs
converts a Cstructcs
into a buffer
val to_bytes : t -> Stdlib.Bytes.t
to_bytes b
converts a bufferb
into Bytes
val elem_at : t -> int -> t_elem
elem_at b i
gives the byte element at the zero-based positioni
of bufferb
val char_of_elem : t_elem -> char
char_of_elem e
converts a byte elemente
to a character (a byte)
val elem_of_char : char -> t_elem
elem_of_char c
convert a bytec
into a buffer element
val hexdump : t -> unit
hexdump_pp b
gives a thunk that pretty-prints the bufferb
to standard output
val hexdump_pp : Stdlib.Format.formatter -> t -> unit
hexdump_pp fmt b
gives a thunk that pretty-prints the bufferb
to the formatterfmt
val t_from_protobuf : Protobuf.Decoder.t -> t
t_from_protobuf d
reads the next value from the protobuf decoderd
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 bufferb
with the protobuf encodere
when called
module Encoding : Dirsp_proscript.PROSCRIPT_ENCODING with type t = t and type t_elem = t_elem
Conversions back and forth between various encodings like hexadecimal.
module Crypto : Dirsp_proscript.PROSCRIPT_CRYPTO with type t = t
Core cryptographic primitives like SHA-256.