Socket
Socket
Sign inDemoInstall

@panva/hkdf

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@panva/hkdf

HKDF with no dependencies using runtime's native crypto


Version published
Weekly downloads
1.2M
increased by8.31%
Maintainers
1
Weekly downloads
 
Created

What is @panva/hkdf?

@panva/hkdf is a Node.js implementation of the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as described in RFC 5869. It is used to derive one or more keys from a single secret key, which is useful in cryptographic applications.

What are @panva/hkdf's main functionalities?

Key Derivation

This feature allows you to derive a key from initial key material (ikm), a salt, and optional context information (info). The derived key length and hash algorithm can be specified.

const { hkdf } = require('@panva/hkdf');

async function deriveKey() {
  const ikm = Buffer.from('initial key material');
  const salt = Buffer.from('salt');
  const info = Buffer.from('info');
  const length = 32; // length of the derived key in bytes
  const hash = 'SHA-256';

  const derivedKey = await hkdf(hash, ikm, salt, info, length);
  console.log(derivedKey.toString('hex'));
}

deriveKey();

Other packages similar to @panva/hkdf

Keywords

FAQs

Package last updated on 03 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc