Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scrypt-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrypt-js

The scrypt password-based key derivation function with asynchronous operation and ablility to be cancelled.

  • 2.0.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is scrypt-js?

The scrypt-js npm package is a JavaScript implementation of the scrypt key derivation function. It is used primarily for securely hashing passwords and generating cryptographic keys.

What are scrypt-js's main functionalities?

Password Hashing

This feature allows you to hash a password using the scrypt key derivation function. The code sample demonstrates how to derive a key from a password and salt with specific parameters.

const scrypt = require('scrypt-js');
const password = Buffer.from('password');
const salt = Buffer.from('salt');
const N = 16384, r = 8, p = 1, dkLen = 32;
scrypt(password, salt, N, r, p, dkLen, (error, progress, key) => {
  if (error) {
    console.error(error);
  } else if (key) {
    console.log('Derived key:', key.toString('hex'));
  }
});

Key Derivation

This feature allows you to derive a cryptographic key from a secret and salt. The code sample shows how to generate a 64-byte key using the scrypt function.

const scrypt = require('scrypt-js');
const secret = Buffer.from('secret');
const salt = Buffer.from('salt');
const N = 16384, r = 8, p = 1, dkLen = 64;
scrypt(secret, salt, N, r, p, dkLen, (error, progress, key) => {
  if (error) {
    console.error(error);
  } else if (key) {
    console.log('Derived key:', key.toString('hex'));
  }
});

Other packages similar to scrypt-js

Keywords

FAQs

Package last updated on 03 Oct 2018

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