Skip to contents

Mirrors the Python morie.crypto.hkdf_sha256(ikm, length=32, salt=b"", info=b"") byte-for-byte. Empty salt defaults to a 32-byte zero-filled salt per RFC 5869 Section 2.2 (matches Python). libsodium's HMAC when rmorie is linked against it, the native one otherwise.

Usage

morie_crypto_hkdf_sha256(ikm, length = 32L, salt = raw(0), info = raw(0))

Arguments

ikm

Input keying material (raw vector).

length

Output length in bytes (1..8160).

salt

Optional salt raw vector. Empty -> zero-fill.

info

Optional context/application info raw vector.

Value

Derived key material as raw vector of length length.

Examples

out <- morie_crypto_hkdf_sha256("seed",
  len = 32L, salt = "salt",
  info = "ctx"
)
length(out)
#> [1] 32