package dirsp-exchange-kbb2017

  1. Overview
  2. Docs

Conversions back and forth between various encodings like hexadecimal.

type t = t

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

type t_elem = t_elem

The type that will be used to represent a single byte

val b2h : t_elem -> t

b2h c converts a byte c into a 2-byte buffer filled with the hexadecimal octet of c.

  • raises Encoding_failure

    for any failure

val hexStringTo32ByteArray : t -> t

hexStringTo32ByteArray hex takes a buffer hex 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 buffer hex 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

OCaml

Innovation. Community. Security.