This commit is contained in:
Hannes Mehnert 2024-03-14 13:14:34 +01:00
parent 25372c91b4
commit c8aa22f0bb
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,10 @@
## oHEX
This package with minimal dependency cone provides functionality to decode and
encode strings into hexadecimal representation.
As example, `Ohex.decode "4142" = "AB"`. And `Ohex.encode "AB" = "4142"`.
There's even the property, for all strings s: `Ohex.(decode (encode s)) = s`.
A pretty-printer is provided as well.

View file

@ -27,7 +27,9 @@ val decode_into : ?skip_whitespace:bool -> string -> bytes -> ?off:int -> unit
val encode : string -> string
(** [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. *)
each character in [s] is encoded as two hex digits in the returned string.
An example: [encode "AB" = "4142"].
*)
val encode_into : string -> bytes -> ?off:int -> unit -> unit
(** [encode_into s dst ~off ()] encodes [s] into [dst] starting at [off]