Created
April 24, 2011 06:06
-
-
Save heroic/939366 to your computer and use it in GitHub Desktop.
bcrypt
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
var bcrypt = require('bcrypt') | |
// function encrypt_password(password, salt, cb) { | |
// var encrypted = password + salt | |
// for (var i=10;i>0;i--) { | |
// encrypted = sha512(encrypted) | |
// } | |
// bcrypt.encrypt(encrypted, salt, function(err, hash) { | |
// cb(hash) | |
// }) | |
// } | |
// encrypt_password('amit','salt', function(hash){ | |
// console.log(hash) | |
// }) | |
bcrypt.encrypt('amitkjh//', 'sal$tedsalt', function(err, hash) { | |
console.log(hash) | |
}) | |
// var bcrypt = require('bcrypt'); bcrypt.gen_salt(10, function(err, salt) { bcrypt.encrypt("B4c0//", salt, function(err, hash) { bcrypt.compare("B4c0//", hash, function(err, res) { console.log(res) | |
// }); bcrypt.compare("not_bacon", hash, function(err, res) { console.log(res) }); }); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment