Created
May 18, 2020 15:46
-
-
Save daveteu/8426390078c5ee1d123e2d940154e33f to your computer and use it in GitHub Desktop.
Bcrypt with NodeJS
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
const bcrypt = require('bcrypt'); | |
let passwordHash; | |
bcrypt.hash('passwordString', 10, function(err, hash) { | |
passwordHash = hash; | |
}); | |
bcrypt.compare('differentpasswordString', passwordHash, function(err, res) { | |
if(res) { | |
console.log(res) //returns true | |
} else { | |
console.log(res) //returns false | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment