Created
January 8, 2015 10:38
-
-
Save aspnetde/5b4d433584c015bdb0b7 to your computer and use it in GitHub Desktop.
Node.js bcrypt password creator
This file contains hidden or 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
var bcrypt = require("bcrypt"); | |
var clearPassword = "test"; | |
bcrypt.genSalt(10, function(err, salt) { | |
bcrypt.hash(clearPassword, salt, function(err, hash) { | |
bcrypt.compare(clearPassword, hash, function(err, res) { | |
if (res === true && !err) { | |
console.log("Hashed password: " + hash); | |
} else { | |
console.warn("ERROR: " + err) | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment