package ohex
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=77f2cbe75b9efd528a2b3478a8d4f3d4
sha512=af72a9699f81878cc7d247a92a28332a8e34f247ad6bd477f8c7ae7f2970b73c4750a31eedf8eeb43ca8d19ae3c4c4f8a9d5421a40b73eb1f1711f44b14ff3e6
doc/ohex/Ohex/index.html
Module OhexSource
Convert from and to hexadecimal representation.
required_length ~skip_whitespace s returns the length needed when the hex string s would be decoded into a sequence of octets. The argument skip_whitespace defaults to true, and skips any whitespace characters (' ', '\n', '\r', '\t'). This function is useful for estimating the space required for decode_into.
decode ~skip_whitespace s decodes a hex string s into a sequence of octets. The argument skip_whitespace defaults to true, and skips any whitespace characters in s (' ', '\n', '\r', '\t'). An example: decode "4142" = "AB".
decode_into ~skip_whitespace s dst ~off () decodes s into dst starting at off (defaults to 0). The argument skip_whitespace defaults to true and skips any whitespace characters.
encode s encodes s into a freshly allocated string of double size, where each character in s is encoded as two hex digits in the returned string. An example: encode "AB" = "4142".
encode_into s dst ~off () encodes s into dst starting at off (defaults to 0). Each character is encoded as two hex digits in dst.
pp ppf s pretty-prints the string s in hexadecimal. Some spaces are emitted for easier readability. No newline is emitted.
val pp_hexdump :
?row_numbers:bool ->
?chars:bool ->
unit ->
Format.formatter ->
string ->
unitpp_hexdump ~row_numbers ~chars () ppf s pretty-prints the string s in hexadecimal (similar to hexdump -C). If row_numbers is provided (defaults to true), each output line is prefixed with the row number. If chars is provided (defaults to true), in the last column the ASCII string is printed (non-printable characters are printed as '.').