Fix for utf-8 characters in md5 passwords (#1183)

This is the same fix as supplied in 1178 but includes a test.

Closes #1178
This commit is contained in:
Brian C 2016-12-13 11:51:36 -06:00 committed by GitHub
parent 981960b445
commit 7f35240a5c
2 changed files with 5 additions and 2 deletions

View File

@ -344,7 +344,7 @@ Client.prototype.end = function(cb) {
};
Client.md5 = function(string) {
return crypto.createHash('md5').update(string).digest('hex');
return crypto.createHash('md5').update(string, 'utf-8').digest('hex');
};
// expose a Query constructor

View File

@ -17,5 +17,8 @@ test('md5 authentication', function() {
.addCString(password).join(true,'p'));
});
});
});
test('md5 of utf-8 strings', function() {
assert.equal(Client.md5('😊'), '5deda34cd95f304948d2bc1b4a62c11e');
});