Cjen1
1
I’m trying to find a function to convert a bytes into hexadecimal. This is in order to manually compare a tcp packet with one captured via wireshark.
Checking the interface on Bytes
it doesn’t look like one exists, however I am most likely mistaken.
Like this?
OCaml version 4.06.1
# Printf.sprintf "0x%02x" 33 ;;
- : string = "0x21"
# Printf.sprintf "%02x" 255 ;;
- : string = "ff"
#
1 Like
An other project is hxd
available on OPAM which wants to mimic xxd
and adds colors.
I use it to debug some Git flows with tcpdump
and it gives me a way to produce regression tests then when it can generate Caml code.
Note that @pqwy recently contributed combinators in Fmt
for hexdumping. See here.
1 Like