Created
February 24, 2020 16:27
-
-
Save heytulsiprasad/9fdc60710c1dd420e5a0c5e1fe04b99f to your computer and use it in GitHub Desktop.
gist having methods of bcrypt to hash passwords and compare efficiently
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shows hashing passwords through famous npm package bcrypt | |
const bcrypt = require("bcryptjs") | |
const myFunction = async () => { | |
const password = "thisisapassword" | |
const hashedPassword = await bcrypt.hash(password, 8) | |
console.log(password) | |
console.log(hashedPassword) | |
const isMatch = await bcrypt.compare(password, hashedPassword) | |
console.log(isMatch) | |
} | |
myFunction(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment