1npm i bcrypt
2
3const bcrypt = require('bcrypt');
4async function hashIt(password){
5 const salt = await bcrypt.genSalt(6);
6 const hashed = await bcrypt.hash(password, salt);
7}
8hashIt(password);
9// compare the password user entered with hashed pass.
10async function compareIt(password){
11 const validPassword = await bcrypt.compare(password, hashedPassword);
12}
13compareIt(password);