Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

npm bcrypt

const bcrypt = require('bcrypt');

// To hash user password (Sync)
let salt = bcrypt.genSaltSync(10)
hashPassword = bcrypt.hashSync(data.password, salt)

// To compare password with hashed password
// Load hash from your password DB.
bcrypt.compareSync(myPlaintextPassword, hash); // true
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #npm #bcrypt
ADD COMMENT
Topic
Name
9+7 =