Skip to content

Instantly share code, notes, and snippets.

@heytulsiprasad
Created February 24, 2020 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heytulsiprasad/9fdc60710c1dd420e5a0c5e1fe04b99f to your computer and use it in GitHub Desktop.
Save heytulsiprasad/9fdc60710c1dd420e5a0c5e1fe04b99f to your computer and use it in GitHub Desktop.
gist having methods of bcrypt to hash passwords and compare efficiently
// 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