Socket
Socket
Sign inDemoInstall

@anzerr/bcrypt.pool

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @anzerr/bcrypt.pool

util for creating worker pools to run bcryptjs


Version published
Weekly downloads
128
increased by19.63%
Maintainers
1
Install size
233 kB
Created
Weekly downloads
 

Readme

Source

Intro

Create a pool of forked workers that will run hash/compare instead of the main thread useful for api to not block the event loop. This uses bcryptjs so should work everywhere without needing to compile.

Install
npm install --save git+https://git@github.com/anzerr/bcrypt.pool.git
npm install --save @anzerr/bcrypt.pool

Example

const BcryptPool = require('bcrypt.pool');

const p = new BcryptPool(4, 12); // will creat 4 workers with 12 hash rounds

Promise.all([
    p.hash('test'),
    p.hash('test'),
    p.hash('test'),
    p.hash('test')
]).then((a) => {
    return Promise.all([
        p.compare('test', a[0]),
        p.compare('test', a[1]),
        p.compare('test', a[2]),
        p.compare('test', a[3])
    ]);
}).then((res) => {
    console.log(res);
});

Keywords

FAQs

Last updated on 21 Jan 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc