From 710a0f64236bf23c78e8590440a40ca2851e09ce Mon Sep 17 00:00:00 2001 From: VaoTsun Date: Tue, 6 Dec 2016 22:02:30 +0000 Subject: [PATCH] utf password md5 bug fixes the bug described in http://stackoverflow.com/questions/33935749/node-js-postgres-utf-connect-string In short: utf password md5 generated is wrong because of binary encoding --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 54ab017cb..770f353d2 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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