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:
parent
981960b445
commit
7f35240a5c
@ -344,7 +344,7 @@ Client.prototype.end = function(cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Client.md5 = function(string) {
|
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
|
// expose a Query constructor
|
||||||
|
@ -17,5 +17,8 @@ test('md5 authentication', function() {
|
|||||||
.addCString(password).join(true,'p'));
|
.addCString(password).join(true,'p'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('md5 of utf-8 strings', function() {
|
||||||
|
assert.equal(Client.md5('😊'), '5deda34cd95f304948d2bc1b4a62c11e');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user