Skip to content

Commit c13112b

Browse files
committed
Revert "crypto.createHash fix for node.js < 11"
This reverts commit fe4c2f5. Testing has shown the changes are not necessary, so this removes code doing version sniffing. closes #757
1 parent ae3e9ec commit c13112b

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

Changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ you spot any mistakes.
77
## HEAD
88

99
* fix authentication w/password failure for node.js 0.10.5 #746 #752
10-
* fix authentication w/password TypeError exception for node.js 0.10.0-0.10.4
10+
* fix authentication w/password TypeError exception for node.js 0.10.0-0.10.4 #747
1111
* fix specifying `values` in `conn.query({...}).on(...)` pattern #755
1212
* fix long stack trace to include the `pool.query(...)` call #715
1313

lib/protocol/Auth.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
var Buffer = require('buffer').Buffer;
22
var Crypto = require('crypto');
33
var Auth = exports;
4-
var semver = require('semver');
5-
6-
var sha1;
7-
if (semver.gt(process.version, '0.10.5')){
8-
// support node.js > 0.10.5
9-
// new interface in node.js 0.10, but exclude < 0.10.5 due to core bugs
10-
sha1 = function(msg) {
11-
var hash = Crypto.createHash('sha1');
12-
hash.setEncoding('binary');
13-
hash.write(msg);
14-
hash.end();
15-
return hash.read();
16-
}
17-
} else {
18-
sha1 = function(msg) {
19-
var hash = Crypto.createHash('sha1');
20-
hash.update(msg);
21-
// hash.digest() does not output buffers yet
22-
return hash.digest('binary');
23-
}
4+
5+
function sha1(msg) {
6+
var hash = Crypto.createHash('sha1');
7+
hash.update(msg, 'binary');
8+
return hash.digest('binary');
249
}
2510
Auth.sha1 = sha1;
2611

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"dependencies": {
1919
"require-all": "0.0.3",
2020
"bignumber.js": "1.0.1",
21-
"readable-stream": "~1.1.9",
22-
"semver": "2.2.1"
21+
"readable-stream": "~1.1.9"
2322
},
2423
"devDependencies": {
2524
"utest": "0.0.6",

0 commit comments

Comments
 (0)