package octez-proto-libs

  1. Overview
  2. Docs
Octez protocol libraries

Install

Dune Dependency

Authors

Maintainers

Sources

octez-19.1.tar.gz
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053

doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V4/Make/Hex/index.html

Module Make.HexSource

Hexadecimal encoding.

Hex defines hexadecimal encodings for characters, strings and Cstruct.t buffers.

type t = [
  1. | `Hex of string
]

The type var hexadecimal values.

Characters

val of_char : char -> char * char

of_char c is the the hexadecimal encoding of the character c.

val to_char : char -> char -> char option

to_char x y is the character corresponding to the xy hexadecimal encoding.

Returns None if x or y are not in the ranges '0'..'9', 'a'..'f', or 'A'..'F'.

Strings

val of_string : ?ignore:char list -> string -> t

of_string s is the hexadecimal representation of the binary string s. If ignore is set, skip the characters in the list when converting. Eg of_string ~ignore:[' '] "a f". The default value of ignore is []).

val to_string : t -> string option

to_string t is the binary string s such that of_string s is t.

Returns None if t contains a character that is not in the range '0'..'9', 'a'..'f', or 'A'..'F'.

Bytes

val of_bytes : ?ignore:char list -> bytes -> t

of_bytes s is the hexadecimal representation of the binary string s. If ignore is set, skip the characters in the list when converting. Eg of_bytes ~ignore:[' '] "a f". The default value of ignore is []).

val to_bytes : t -> bytes option

to_bytes t is the binary string s such that of_bytes s is t.

Returns None if t contains a character that is not in the range '0'..'9', 'a'..'f', or 'A'..'F'.

Debugging

val hexdump_s : ?print_row_numbers:bool -> ?print_chars:bool -> t -> string

Same as hexdump except returns a string.

Pretty printing

val pp : Format.formatter -> t -> unit

pp fmt t will output a human-readable hex representation of t to the formatter fmt.

val show : t -> string

show t will return a human-readable hex representation of t as a string.

OCaml

Innovation. Community. Security.