0.1.9 • Published 4 years ago
bcrypt-rust-wasm v0.1.9
Functionalities
- Hash passwords
- Custom rounds for salt
- Verify hashed passwords
- Faster than the pure JS implementation
Instructions to run
- Pre-requisites: - NPM
Installation with NPM
npm i -s bcrypt-rust-wasm
Usage
This library is currently compatible with NodeJS and supports the synchronous bindings only.
Importing
const { Bcrypt } = require('bcrypt-rust-wasm');
...
Obtaining an instance
// Get a bcrypt instance with a default number of seed rounds
const bcryptDefault = Bcrypt.default();
// Get a bcrypt instance with a specified number of seed rounds
const bcrypt = Bcrypt.new(10);
Hashing
const hash = bcrypt.hashSync('password');
// hash: "$2b$04$fsiGFAMtgNJ8YIszhoxusObEgoLF.faqMIKXiRDp5GZbzFWzebgcu"
Verifying a hash
bcrypt.verifySync("password", hash) // true
bcrypt.verifySync("password123", hash) // false
Building from source
How to build in release mode
# Builds the project and places it into the `pkg` folder.
npm run build
Dependencies for building
Contributors
- @ATechnoHazard - for the implementation
- @L04DB4L4NC3R - for the idea