function hkdfSync
Usage in Deno
import { hkdfSync } from "node:crypto";
hkdfSync(): ArrayBuffer
Provides a synchronous HKDF key derivation function as defined in RFC 5869. The
given ikm
, salt
and info
are used with the digest
to derive a key of keylen
bytes.
The successfully generated derivedKey
will be returned as an ArrayBuffer.
An error will be thrown if any of the input arguments specify invalid values or types, or if the derived key cannot be generated.
import { Buffer } from 'node:buffer'; const { hkdfSync, } = await import('node:crypto'); const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
ikm: BinaryLike | KeyObject
The input keying material. Must be provided but can be zero-length.
salt: BinaryLike
The salt value. Must be provided but can be zero-length.
info: BinaryLike
Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
ArrayBuffer