Instale o BCrypt
>> npm install bcrypt
const bcrypt = require('bcrypt');
Ham-Solo
>> npm install bcrypt
const bcrypt = require('bcrypt');
npm install bcryptjs
npm i bcryptjs
# yarn
yarn add bcryptjs
npm install bcrypt
bcrypt.genSalt(saltRounds, function(err, salt) {
bcrypt.hash(myPlaintextPassword, salt, function(err, hash) {
// Store hash in your password DB.
});
});
// Load hash from your password DB.
bcrypt.compare(myPlaintextPassword, hash, function(err, result) {
// result == true
});
bcrypt.compare(someOtherPlaintextPassword, hash, function(err, result) {
// result == false
});