Node.js based forum software built for the modern web
shorter bcrypt
Barış Soner Uşaklı56ed6d211250
diff --git a/bcrypt.js b/bcrypt.jsindex 1445999a8a..ae81d09eb7 100644--- a/bcrypt.js+++ b/bcrypt.js@@ -9,11 +9,10 @@ process.on('message', function(msg) {if (msg.type === 'hash') {hashPassword(msg.password, msg.rounds);} else if (msg.type === 'compare') {- compare(msg.password, msg.hash);+ bcrypt.compare(msg.password, msg.hash, done);}});-function hashPassword(password, rounds) {async.waterfall([function(next) {@@ -22,23 +21,14 @@ function hashPassword(password, rounds) {function(salt, next) {bcrypt.hash(password, salt, next);}- ], function(err, hash) {- if (err) {- process.send({err: err.message});- return process.disconnect();- }- process.send({result: hash});- process.disconnect();- });+ ], done);}-function compare(password, hash) {- bcrypt.compare(password, hash, function(err, res) {- if (err) {- process.send({err: err.message});- return process.disconnect();- }- process.send({result: res});- process.disconnect();- });+function done(err, result) {+ if (err) {+ process.send({err: err.message});+ return process.disconnect();+ }+ process.send({result: result});+ process.disconnect();}\ No newline at end of file