package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-libs.stdlib/Tezos_stdlib/Hex/index.html
Module Tezos_stdlib.Hex
Source
Hexadecimal encoding.
TzHex
defines hexadecimal encodings for characters, strings and Cstruct.t buffers.
The type var hexadecimal values.
Characters
of_char c
is the the hexadecimal encoding of the character c
.
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
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 []
).
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
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 []
).
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
Same as hexdump
except returns a string.
Pretty printing
pp fmt t
will output a human-readable hex representation of t
to the formatter fmt
.