README.md

kdf - Key Derivation Functions #

This repository provides multiple already specified key derivation functions in and for OCaml:

Documentation #

API Documentation

Installation #

Install with opam:

$ opam install nox-kdf

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install nox-kdf

Example #

Derive protocol-specific keys with HKDF or password-derived keys with PBKDF2/scrypt, depending on the secret material you start with:

let salt = "deployment-2026"
let ikm = "shared input key material"

let key =
  let prk = Hkdf.extract ~hash:`SHA256 ~salt ikm in
  Hkdf.expand ~hash:`SHA256 ~prk ~info:"api-token" 32