🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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 sync and cancellable async.

3.0.1
latest
Source
npm
Version published
Weekly downloads
1.8M
32.04%
Maintainers
1
Weekly downloads
 
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

scrypt

FAQs

Package last updated on 19 May 2020

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