1.0.1 • Published 5 months ago

hkdf_sm3 v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

About

The HDKF (HMAC-based Key Derivation Function) implemented with SM3.

Install

npm install hkdf_sm3   ##use npm
yarn add hkdf_sm3      ##use yarn
pnpm install hkdf_sm3  ##use pnpm

Usage

//es6 module
import { HKDF } from 'hdkf_sm3';
//or
import HKDF from 'hdkf_sm3';

//commonjs
const { HKDF } = require('hkdf_sm3');

const ikm = new Uint8Array([1,2,3,4,5,6,7,8])
const salt = new Uint8Array([1,2,3,4,5,6,7,8])
const info = new Uint8Array([1,2,3,4,5,6,7,8])
const length = 16;
HKDF(ikm,salt,info,length);
//Uint8Array(16) [235, 161, 114, 43, 215, 157, 61, 0, 30, 241, 88, 42,210, 63, 248, 218]

Params

function HKDF(key: Uint8Array, salt?: Uint8Array, info?: Uint8Array, length?: number): Uint8Array;

ParamTypeDefaultDescription
ikmUint8ArrayInitial Keying Material
saltUint8ArrayUint8Array(32) 0,...,0 Optional salt (recommended)
infoUint8ArrayUint8Array(0) [] Optional context (safe to skip)
lengthinteger 32 Required byte length of output
1.0.1

5 months ago

1.0.0

5 months ago