Created
March 7, 2018 06:58
-
-
Save hassaananjum/6e4620bd54786367f261d3ad2c3d5165 to your computer and use it in GitHub Desktop.
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
//basic usage bcrypt hashing | |
var bcrypt = require('bcrypt'); | |
function createHash(password){ | |
bcrypt.genSalt(10, function(err, salt) { | |
bcrypt.hash(password, salt, function (err, hash) { | |
if (err) { | |
console.log(err); | |
return err; | |
} else { | |
console.log(hash); | |
bcrypt.compare('redbuffer', hash).then(function(res){ | |
console.log(res); | |
}).catch(function(err){ | |
console.log(err); | |
}) | |
return hash; | |
} | |
}); | |
}); | |
} | |
createHash('12345'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment