Hi there!
I’m happy to announce the release of a new major version (i.e., 2.0) of the crypt library (bindings to the Unix crypt function). The previous version, 1.3, was outdated, since the last commit was six years ago. This version does not support correct compilation on various Unix platforms (Linux, FreeBSD, macOS), and uses deprecated tools. However, the new version addresses these issues: it supports Linux, FreeBSD and macOS, uses modern tools, has safe C stubs, provides excellent documentation, and features an idiomatic high-level wrapper.
Installation
by OPAM package manager:
$ opam install crypt.2.0
Example of usage
# #require "crypt";;
# Crypt.crypt ~salt:"GUBv0xjJ" "hello";;
- : string = "GUpsIDCLVu8AY"
# Crypt.crypt ~derivation:Md5 ~salt:"GUBv0xjJ" "hello";;
- : string = "$1$GUBv0xjJ$rQSvX8r6cT7H/NItzzVNQ/"
If you don’t provide any salt, a new salt will be generated every time the function is called.
# Crypt.crypt "hello";;
- : string = "QwD.wi5nLT/0s"
# Crypt.crypt "hello";;
- : string = "MYM.5hv5Lk2Mg"
But for a deterministic generation, you should use one salt that you can generate using the Crypt.Salt module or another external module.
# let salt = Crypt.Salt.gen_base64 9;;
val salt : string = "dHiPl3q99"
# Crypt.crypt ~salt "hello";;
- : string = "dHDdeFGUWcGyQ"
P.S.
Project that uses crypt:
- Recently I wrote toy implementation of
loginutility written in OCaml