Skip to content

Commit 8f59d96

Browse files
committed
[Fix] restore node 0.10 support
…in which algorithms are not specifiable and only HMAC-SHA1 is supported
1 parent d2dc5f0 commit 8f59d96

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818

1919
"rules": {
20+
"complexity": "off",
2021
"func-style": "warn",
2122
"max-params": "warn",
2223
"multiline-comment-style": "off",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"to-buffer": "^1.2.1"
5858
},
5959
"engines": {
60-
"node": ">=0.12"
60+
"node": ">= 0.10"
6161
},
6262
"auto-changelog": {
6363
"output": "CHANGELOG.md",

test/index.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,26 @@ function runTests(name, compat) {
231231
}
232232

233233
tape('does not return all zeroes for any algorithm', function (t) {
234-
var algos2 = [
234+
// node 0.10 only supports HMAC-SHA1
235+
var is010 = node.pbkdf2Sync.length < 5;
236+
237+
var algos2 = [].concat(
235238
// 'sha3-512',
236239
// 'sha3-256',
237240
// 'SHA3-384',
238241
// 'blake2b512',
239-
'Sha256',
240-
'ShA256',
241-
'Sha512',
242-
'sha512-256',
243-
'SHA512',
242+
is010 ? [] : 'Sha256',
243+
is010 ? [] : 'ShA256',
244+
is010 ? [] : 'Sha512',
245+
is010 ? [] : 'sha512-256',
246+
is010 ? [] : 'SHA512',
244247
'SHA1',
245-
's-h-a-1',
248+
is010 ? [] : 's-h-a-1',
246249
'sha-1',
247-
'RMD160',
248-
'RIPEMD-160',
249-
'ripemd-160'
250-
];
250+
is010 ? [] : 'RMD160',
251+
is010 ? [] : 'RIPEMD-160',
252+
is010 ? [] : 'ripemd-160'
253+
);
251254
algos2.forEach(function (algo) {
252255
var throwCount = 0;
253256
var impls = { __proto__: null, node: node.pbkdf2Sync, lib: js.pbkdf2Sync, browser: browserImpl };
@@ -324,7 +327,12 @@ tape('does not return all zeroes for any algorithm', function (t) {
324327
throws,
325328
expected,
326329
'all implementations throw for ' + algo,
327-
{ todo: throwCount === 1 && algo === 'sha512-256' && 'sha.js does not yet support sha512-256' }
330+
{
331+
// https://nodejs.org/download/release/v0.10.0/docs/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_callback
332+
todo: is010
333+
? 'node 0.10 does not support the algo argument'
334+
: throwCount === 1 && algo === 'sha512-256' && 'sha.js does not yet support sha512-256'
335+
}
328336
);
329337
}
330338
});

0 commit comments

Comments
 (0)