Bindings for bcrypt in Reason


013.0.03 years ago4 years agoMinified + gzip package size for @ncthbrt/rebcrypt in KB



This is a simple wrapper around node bcrypt for BuckleScript and Reason.

Getting Started

Install rebcrypt using npm:

npm install --save @ncthbrt/rebcrypt

Then add @ncthbrt/rebcrypt as a dependency in bsconfig.json.


Bcrypt is a widely used adaptive password hashing function which also includes a mechanism to correctly salt a password. It is adaptive in that the number of rounds used to hash the password can be increased in response to an increase in computing power.

This library offers two ways of hashing a password. You can generate the salt separately and then hash the password by including the generated salt, or you can hash and salt the password at the same time.

The library provides both synchronous and asynchronous promise returning methods.

Generating the Salt then Hashing

/* gen() returns a promise instead */
let salt = Bcrypt.Salt.genSync(~rounds=15, ());
let hash = Bcrypt.Hash.makeSync("REALLY SECURE PASSWORD", salt);

Simultaneously Salting and Hashing

let hash = hashAndSaltSync(~rounds=15, "REALLY SECURE PASSWORD");

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.