Module type Dirsp_proscript.PROSCRIPT_ENCODING
The ProScript.encoding
interface for conversions back and forth between various encodings like hexadecimal.
type t
The type that will be used to represent contiguous bytes; typically either Bytes.t or Cstruct.t
val b2h : t_elem -> t
b2h c
converts a bytec
into a 2-byte buffer filled with the hexadecimal octet ofc
.- raises Encoding_failure
for any failure
val hexStringTo32ByteArray : t -> t
hexStringTo32ByteArray hex
takes a bufferhex
of a hexadecimal text of least length 64 and then converts it to the 32 bytes the hexadecimal octets represents.This function signature looks odd because it doesn't take in a string. Since ProScript -> OCaml auto-translation must convert all strings immediately into buffers because the translator can't deduce when it is appropriate to use strings or buffers, your code needs to do use buffers consistently as well.
- raises Encoding_failure
for any failure
val hexStringTo12ByteArray : t -> t
hexStringTo12ByteArray hex
takes a bufferhex
of a hexadecimal text of at least length 24 and then converts it to the 12 bytes the hexadecimal octets represents.This function signature looks odd because it doesn't take in a string. Since ProScript -> OCaml auto-translation must convert all strings immediately into buffers because the translator can't deduce when it is appropriate to use strings or buffers, your code needs to do use buffers consistently as well.
- raises Encoding_failure
for any failure