Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d30911e

Browse filesBrowse files
dnluptargos
authored andcommitted
benchmark: use let instead of var in crypto
PR-URL: #31135 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 25fb34c commit d30911e
Copy full SHA for d30911e

File tree

Expand file treeCollapse file tree

6 files changed

+14
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+14
-14
lines changed
Open diff view settings
Collapse file

‎benchmark/crypto/aes-gcm-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/aes-gcm-throughput.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) {
2525
const bits = written * 8;
2626
const mbits = bits / (1024 * 1024);
2727

28-
for (var i = 0; i < n; i++) {
28+
for (let i = 0; i < n; i++) {
2929
const alice = crypto.createCipheriv(cipher, key, iv);
3030
alice.setAAD(associate_data);
3131
const enc = alice.update(message);
Collapse file

‎benchmark/crypto/cipher-stream.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/cipher-stream.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ function main({ api, cipher, type, len, writes }) {
3838
const alice_cipher = crypto.createCipher(cipher, alice_secret);
3939
const bob_cipher = crypto.createDecipher(cipher, bob_secret);
4040

41-
var message;
42-
var encoding;
41+
let message;
42+
let encoding;
4343
switch (type) {
4444
case 'asc':
4545
message = 'a'.repeat(len);
@@ -65,7 +65,7 @@ function main({ api, cipher, type, len, writes }) {
6565
}
6666

6767
function streamWrite(alice, bob, message, encoding, writes) {
68-
var written = 0;
68+
let written = 0;
6969
bob.on('data', (c) => {
7070
written += c.length;
7171
});
@@ -86,9 +86,9 @@ function streamWrite(alice, bob, message, encoding, writes) {
8686
}
8787

8888
function legacyWrite(alice, bob, message, encoding, writes) {
89-
var written = 0;
90-
var enc, dec;
91-
for (var i = 0; i < writes; i++) {
89+
let written = 0;
90+
let enc, dec;
91+
for (let i = 0; i < writes; i++) {
9292
enc = alice.update(message, encoding);
9393
dec = bob.update(enc);
9494
written += dec.length;
Collapse file

‎benchmark/crypto/get-ciphers.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/get-ciphers.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, {
99

1010
function main({ n, v }) {
1111
const method = require(v).getCiphers;
12-
var i = 0;
12+
let i = 0;
1313
// First call to getCiphers will dominate the results
1414
if (n > 1) {
1515
for (; i < n; i++)
Collapse file

‎benchmark/crypto/hash-stream-creation.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/hash-stream-creation.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ function main({ api, type, len, out, writes, algo }) {
2020
api = 'legacy';
2121
}
2222

23-
var message;
24-
var encoding;
23+
let message;
24+
let encoding;
2525
switch (type) {
2626
case 'asc':
2727
message = 'a'.repeat(len);
@@ -52,7 +52,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) {
5252
while (writes-- > 0) {
5353
const h = crypto.createHash(algo);
5454
h.update(message, encoding);
55-
var res = h.digest(outEnc);
55+
let res = h.digest(outEnc);
5656

5757
// Include buffer creation costs for older versions
5858
if (outEnc === 'buffer' && typeof res === 'string')
Collapse file

‎benchmark/crypto/hash-stream-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/hash-stream-throughput.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function main({ api, type, len, algo, writes }) {
1919
api = 'legacy';
2020
}
2121

22-
var message;
23-
var encoding;
22+
let message;
23+
let encoding;
2424
switch (type) {
2525
case 'asc':
2626
message = 'a'.repeat(len);
Collapse file

‎benchmark/crypto/rsa-encrypt-decrypt-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/rsa-encrypt-decrypt-throughput.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function StreamWrite(algo, keylen, message, n, len) {
3535

3636
const privateKey = RSA_PrivatePem[keylen];
3737
const publicKey = RSA_PublicPem[keylen];
38-
for (var i = 0; i < n; i++) {
38+
for (let i = 0; i < n; i++) {
3939
const enc = crypto.privateEncrypt(privateKey, message);
4040
crypto.publicDecrypt(publicKey, enc);
4141
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.