-
-
Notifications
You must be signed in to change notification settings - Fork 34.8k
test: remove var redeclarations in test-crypto-* #4981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,12 +59,12 @@ var wikipedia = [ | |
| }, | ||
| ]; | ||
|
|
||
| for (var i = 0, l = wikipedia.length; i < l; i++) { | ||
| for (var hash in wikipedia[i]['hmac']) { | ||
| for (let i = 0, l = wikipedia.length; i < l; i++) { | ||
| for (const hash in wikipedia[i]['hmac']) { | ||
| // FIPS does not support MD5. | ||
| if (common.hasFipsCrypto && hash == 'md5') | ||
| continue; | ||
| var result = crypto.createHmac(hash, wikipedia[i]['key']) | ||
| const result = crypto.createHmac(hash, wikipedia[i]['key']) | ||
| .update(wikipedia[i]['data']) | ||
| .digest('hex'); | ||
| assert.equal(wikipedia[i]['hmac'][hash], | ||
|
|
@@ -221,14 +221,14 @@ var rfc4231 = [ | |
| } | ||
| ]; | ||
|
|
||
| for (var i = 0, l = rfc4231.length; i < l; i++) { | ||
| for (var hash in rfc4231[i]['hmac']) { | ||
| var str = crypto.createHmac(hash, rfc4231[i].key); | ||
| for (let i = 0, l = rfc4231.length; i < l; i++) { | ||
| for (const hash in rfc4231[i]['hmac']) { | ||
|
||
| const str = crypto.createHmac(hash, rfc4231[i].key); | ||
| str.end(rfc4231[i].data); | ||
| var strRes = str.read().toString('hex'); | ||
| var result = crypto.createHmac(hash, rfc4231[i]['key']) | ||
| .update(rfc4231[i]['data']) | ||
| .digest('hex'); | ||
| let strRes = str.read().toString('hex'); | ||
| let result = crypto.createHmac(hash, rfc4231[i]['key']) | ||
| .update(rfc4231[i]['data']) | ||
| .digest('hex'); | ||
| if (rfc4231[i]['truncate']) { | ||
| result = result.substr(0, 32); // first 128 bits == 32 hex chars | ||
| strRes = strRes.substr(0, 32); | ||
|
|
@@ -350,15 +350,15 @@ var rfc2202_sha1 = [ | |
| ]; | ||
|
|
||
| if (!common.hasFipsCrypto) { | ||
| for (var i = 0, l = rfc2202_md5.length; i < l; i++) { | ||
| for (let i = 0, l = rfc2202_md5.length; i < l; i++) { | ||
| assert.equal(rfc2202_md5[i]['hmac'], | ||
| crypto.createHmac('md5', rfc2202_md5[i]['key']) | ||
| .update(rfc2202_md5[i]['data']) | ||
| .digest('hex'), | ||
| 'Test HMAC-MD5 : Test case ' + (i + 1) + ' rfc 2202'); | ||
| } | ||
| } | ||
| for (var i = 0, l = rfc2202_sha1.length; i < l; i++) { | ||
| for (let i = 0, l = rfc2202_sha1.length; i < l; i++) { | ||
| assert.equal(rfc2202_sha1[i]['hmac'], | ||
| crypto.createHmac('sha1', rfc2202_sha1[i]['key']) | ||
| .update(rfc2202_sha1[i]['data']) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one was missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops! Thanks. Fixed it!