1.0.2 • Published 9 years ago
nu-bcrypt v1.0.2
nu-bcrypt
A library for interfacing with bcrypt using promises.
Install
npm install nu-bcrypt
#hash(str, rounds)
Example
const bcrypt = require('nu-bcrypt');
bcrypt.hash('password', 10).then(function (result) {
// result === hashed string
});
#compare(str, hash)
Example
const bcrypt = require('nu-bcrypt');
const hash = bcrypt.hash('password', 12);
bcrypt.compare('password', hash).then(function (result) {
// result === true
});
bcrypt.compare('incorrect', hash).then(function (result) {
// result === false
});
#getRounds(hash)
Example
const bcrypt = require('nu-bcrypt');
const hash = bcrypt.hash('password', 12);
const rounds = bcrypt.getRounds(hash);
// rounds === 12
License
MIT