Socket
Socket
Sign inDemoInstall

@node-rs/bcrypt

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-rs/bcrypt

Rust bcrypt binding


Version published
Weekly downloads
94K
decreased by-15.89%
Maintainers
2
Weekly downloads
 
Created

What is @node-rs/bcrypt?

@node-rs/bcrypt is a high-performance bcrypt library for Node.js, written in Rust. It provides functionalities for hashing passwords and verifying password hashes, leveraging the speed and safety of Rust.

What are @node-rs/bcrypt's main functionalities?

Hashing Passwords

This feature allows you to hash a password using bcrypt. The `hash` function takes a password and the number of salt rounds as arguments and returns a hashed password.

const bcrypt = require('@node-rs/bcrypt');

async function hashPassword(password) {
  const saltRounds = 10;
  const hashedPassword = await bcrypt.hash(password, saltRounds);
  console.log(hashedPassword);
}

hashPassword('myPassword123');

Verifying Passwords

This feature allows you to verify a password against a hashed password. The `verify` function takes a password and a hashed password as arguments and returns a boolean indicating whether the password matches the hash.

const bcrypt = require('@node-rs/bcrypt');

async function verifyPassword(password, hashedPassword) {
  const isMatch = await bcrypt.verify(password, hashedPassword);
  console.log(isMatch);
}

const hashedPassword = '$2b$10$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36Fjs1l4iZ7z6Z9p6x7XKmi';
verifyPassword('myPassword123', hashedPassword);

Other packages similar to @node-rs/bcrypt

Keywords

FAQs

Package last updated on 23 Apr 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