hkdf_sm3
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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;

Param Type Default Description
ikm Uint8Array Initial Keying Material
salt Uint8Array Uint8Array(32) [0,...,0] Optional salt (recommended)
info Uint8Array Uint8Array(0) [] Optional context (safe to skip)
length integer 32 Required byte length of output

Readme

Keywords

Package Sidebar

Install

npm i hkdf_sm3

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

13.1 kB

Total Files

5

Last publish

Collaborators

  • prot3in