- Stack Overflow Salt/Hash
- Medium Article on Hashing
- Different Source About Hashing
- Hashing Data Structure
- npm bcrypt
- npm bcryptjs
const bcrypt = require("bcrypt");
const saltRounds = 8;
const plainTextPassword1 = "DFGh5546*%^__90";
bcrypt
.genSalt(8)
.then(salt => {
console.log(`Salt: ${salt}`);
return bcrypt.hash('DFGh5546*%^__90', '$2b$08$GDaOC.xi.6tChS8B1IOXt.');
})
.then(hash => {
console.log(`hash: ${hash}`);
// Store hash in your password DB.
})
.catch(err => console.error(err.message));
const hash = "$2b$08$GDaOC.xi.6tChS8B1IOXt.aXlD0XyLAlDbLNzJUaQjWicqyedDpie";
bcrypt.compare(plainTextPassword1, hash).then(res => {
console.log(res);
})
.catch(err => console.error(err.message));