HKDF

Provides a simple Hashed Message Authentication Code (HMAC)-based key derivation function (HKDF).

Based on the algorithm defined in rfc 5859.

Usage

Derive key:

HKDF.derive(:sha256, "some input", 42, "optional salt", "optional secret message")

Expand pseudorandom key:

HKDF.extract(:sha256, "some input", "optional salt")

Extract output key material:

prk = HKDF.extract(:sha256, "some input", "optional salt")
HKDF.expand(:sha256, prk, 16, "optional secret message")

Installation

If available in Hex, the package can be installed by adding hkdf to your list of dependencies in mix.exs:

def deps do
  [{:hkdf, "~> 0.2.0"}]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/hkdf.