alfred-bcrypt

0.1.2-1 • Public • Published

bcrypt-node

Lib to help you hash passwords.
bcrypt on wikipedia

Catalyst: How To Safely Store A Password

Dependencies

  • NodeJS
  • BSD Libs (non-mac)

From NPM

npm install bcrypt

From Source

I run K/Ubuntu. I was able to pull in the bsd libs using:
sudo apt-get install libbsd-dev
Eventually I'd like to get it so that the libs are all built in to the same package. But, as a work in progress, this gets the job done for now.

What is required is the file stdlib.h within /usr/includes/bsd/ and the compiled bsd libs in /usr/lib/. These have to match the conf.check.

Assuming you've already built node, you can run the waf script:
node-waf configure node-waf build npm link

Usage

To hash a password:
var bcrypt = require('bcrypt');
var salt = bcrypt.gen_salt(10);
var hash = bcrypt.hashpw("B4c0//", salt);

To check a password:
var bcrypt = require('bcrypt');
bcrypt.compare("B4c0//", hash); // true
bcrypt.compare("not_bacon", hash); // false

Testing

I am using nodeunit. I like the way you write tests with it and I like the default output. As such you'll need it to run the tests. I suspect my tests would run on an older version, but these were written and worked against 0.3.1 npm install nodeunit@0.3.1 nodeunit test/

Credits

The code for this comes from a few sources:

Contributors

Antonio Salazar Cardozo

License

Unless stated elsewhere, file headers or otherwise, the license as stated in the LICENSE file.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2-1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2-1
    1

Package Sidebar

Install

npm i alfred-bcrypt

Weekly Downloads

1

Version

0.1.2-1

License

none

Last publish

Collaborators

  • alfredwesterveld