New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash function broken in Node v0.10 #3

Merged
merged 1 commit into from Nov 22, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+4 −2
Diff settings

Always

Just for now

Copy path View file
@@ -55,7 +55,9 @@ exports.hash = function(pwd, salt, fn){
if (3 == arguments.length) {
if (!pwd) return fn(new Error('password missing'));
if (!salt) return fn(new Error('salt missing'));
crypto.pbkdf2(pwd, salt, iterations, len, fn);
crypto.pbkdf2(pwd, salt, iterations, len, function(err, hash){
fn(err, (new Buffer(hash, 'binary')).toString('base64'));
});
} else {
fn = salt;
if (!pwd) return fn(new Error('password missing'));
@@ -64,7 +66,7 @@ exports.hash = function(pwd, salt, fn){
salt = salt.toString('base64');
crypto.pbkdf2(pwd, salt, iterations, len, function(err, hash){
if (err) return fn(err);
fn(null, salt, hash);
fn(null, salt, (new Buffer(hash, 'binary')).toString('base64'));
});
});
}
ProTip! Use n and p to navigate between commits in a pull request.