hashids-ocaml is an OCaml (4.02.3+) implementation of hashids. It generates short, unique, non-sequential ids from numbers, that you can also decode. It is compatible with version 1.0.0 of hashids.
Questions? Remarks? Bugs? Want to contribute? Open an issue!
Install from OPAM:
$ opam install hashids
$ utop -require hashids
Create a config:
utop # let config = Hashids.make ();; val config : Hashids.t = <abstr>
Encode some integers:
utop # Hashids.encode config [42; 57];; - : string = "wYcGX"
And decode them:
utop # Hashids.decode config "wYcGX";; - : int list = [42; 57]