New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bcrypt.wasm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcrypt.wasm

bcrypt in WebAssembly

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bcrypt.wasm

Current Version Build Status via Travis CI Dependencies belly-button-style

WebAssembly implementation of bcrypt. This module began life as a quasi-fork of the bcrypt module. Currently, only the synchronous APIs are available.

Basic Usage

'use strict';
const Bcrypt = require('bcrypt.wasm');
const data = 'password';
const salt = Bcrypt.genSaltSync();
const hash = Bcrypt.hashSync(data, salt);

Bcrypt.compareSync(data, hash); // equals true
Bcrypt.compareSync(data + 'x', hash); // equals false

API

bcrypt.wasm exports the following methods.

compareSync(data, hash)

  • Arguments
    • data (string) - Cleartext data to compare against an encrypted hash.
    • hash (string) - An encrypted hash to compare against cleartext input.
  • Returns
    • match (boolean) - true if the comparison succeeds, and false otherwise.

genSaltSync(rounds)

  • Arguments
    • rounds (number) - The cost of generating a salt. Optional. Defaults to 10.
  • Returns
    • salt (string) - The generated salt.

getRounds(hash)

  • Arguments
    • hash (string) - An encrypted hash.
  • Returns
    • rounds (number) - The number of rounds used to encrypt hash.

hashSync(data, salt)

  • Arguments
    • data (string) - Cleartext data to encrypt.
    • salt (number or string) - The salt used to hash data. If salt is a number, it is passed to genSaltSync() to generate a salt string.
  • Returns
    • hash (string) - The encrypted hash of data using salt.

Keywords

FAQs

Package last updated on 29 Mar 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