ocaml-hkdf#
HMAC-based Extract-and-Expand Key Derivation Function (RFC 5869) for OCaml.
This is a rewrite of the upstream
hkdf package (1.0.4) which
depends on mirage-crypto and Cstruct.t. This version uses
digestif for HMAC and plain
bytes for all buffers, avoiding the mirage-crypto and cstruct
dependency chain.
Installation#
Install with opam:
$ opam install nox-hkdf
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-hkdf
Usage#
let key = Hkdf.derive
~hash:`SHA256
~salt:Bytes.empty
~ikm:(Bytes.of_string "input key material")
~info:(Bytes.of_string "application context")
~len:32
References#
- RFC 5869 — HKDF specification
- NIST SP 800-56C — Key derivation recommendations
Licence#
ISC