I’m happy and proud to announce the OCaml port of the famous CUID library. I’ve also implemented a stressing test to ensure the collision-resistance property (and also another one covering the monotonically increasing nature of CUIDs).
CUIDs are quite excellent replacements for UUIDs. They’re ordered by the timestamp/counter prefix, it can improve a lot databases lookup on CUIDs as custom primary keys.
IMPORTANT NOTES: This library is not thread-safe 'cause I have not implemented a lock around the internal counter yet.
The installation is through the following package name:
$ opam install cuid
For the next releases, I’m planning to implement slugs (short & weak CUIDs) and a testing covering a “next-CUIDs” guessing/prediction attack (and thus, prove that the implementation is somehow secure while being hard to break/attack). If such test fails, it’s a signal to search out a better random generation API, tho.
Happy hacking, guys!