| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ function AEAD_Bench(cipher, message, associate_data, key, iv, n, len) { | |||
| 25 | 25 | const bits = written * 8; | |
| 26 | 26 | const mbits = bits / (1024 * 1024); | |
| 27 | 27 | ||
| 28 | - for (var i = 0; i < n; i++) { | ||
| 28 | + for (let i = 0; i < n; i++) { | ||
| 29 | 29 | const alice = crypto.createCipheriv(cipher, key, iv); | |
| 30 | 30 | alice.setAAD(associate_data); | |
| 31 | 31 | const enc = alice.update(message); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,8 +38,8 @@ function main({ api, cipher, type, len, writes }) { | |||
| 38 | 38 | const alice_cipher = crypto.createCipher(cipher, alice_secret); | |
| 39 | 39 | const bob_cipher = crypto.createDecipher(cipher, bob_secret); | |
| 40 | 40 | ||
| 41 | - var message; | ||
| 42 | - var encoding; | ||
| 41 | + let message; | ||
| 42 | + let encoding; | ||
| 43 | 43 | switch (type) { | |
| 44 | 44 | case 'asc': | |
| 45 | 45 | message = 'a'.repeat(len); | |
@@ -65,7 +65,7 @@ function main({ api, cipher, type, len, writes }) { | |||
| 65 | 65 | } | |
| 66 | 66 | ||
| 67 | 67 | function streamWrite(alice, bob, message, encoding, writes) { | |
| 68 | - var written = 0; | ||
| 68 | + let written = 0; | ||
| 69 | 69 | bob.on('data', (c) => { | |
| 70 | 70 | written += c.length; | |
| 71 | 71 | }); | |
@@ -86,9 +86,9 @@ function streamWrite(alice, bob, message, encoding, writes) { | |||
| 86 | 86 | } | |
| 87 | 87 | ||
| 88 | 88 | 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++) { | ||
| 92 | 92 | enc = alice.update(message, encoding); | |
| 93 | 93 | dec = bob.update(enc); | |
| 94 | 94 | written += dec.length; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { | |||
| 9 | 9 | ||
| 10 | 10 | function main({ n, v }) { | |
| 11 | 11 | const method = require(v).getCiphers; | |
| 12 | - var i = 0; | ||
| 12 | + let i = 0; | ||
| 13 | 13 | // First call to getCiphers will dominate the results | |
| 14 | 14 | if (n > 1) { | |
| 15 | 15 | for (; i < n; i++) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,8 +20,8 @@ function main({ api, type, len, out, writes, algo }) { | |||
| 20 | 20 | api = 'legacy'; | |
| 21 | 21 | } | |
| 22 | 22 | ||
| 23 | - var message; | ||
| 24 | - var encoding; | ||
| 23 | + let message; | ||
| 24 | + let encoding; | ||
| 25 | 25 | switch (type) { | |
| 26 | 26 | case 'asc': | |
| 27 | 27 | message = 'a'.repeat(len); | |
@@ -52,7 +52,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) { | |||
| 52 | 52 | while (writes-- > 0) { | |
| 53 | 53 | const h = crypto.createHash(algo); | |
| 54 | 54 | h.update(message, encoding); | |
| 55 | - var res = h.digest(outEnc); | ||
| 55 | + let res = h.digest(outEnc); | ||
| 56 | 56 | ||
| 57 | 57 | // Include buffer creation costs for older versions | |
| 58 | 58 | if (outEnc === 'buffer' && typeof res === 'string') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,8 +19,8 @@ function main({ api, type, len, algo, writes }) { | |||
| 19 | 19 | api = 'legacy'; | |
| 20 | 20 | } | |
| 21 | 21 | ||
| 22 | - var message; | ||
| 23 | - var encoding; | ||
| 22 | + let message; | ||
| 23 | + let encoding; | ||
| 24 | 24 | switch (type) { | |
| 25 | 25 | case 'asc': | |
| 26 | 26 | message = 'a'.repeat(len); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ function StreamWrite(algo, keylen, message, n, len) { | |||
| 35 | 35 | ||
| 36 | 36 | const privateKey = RSA_PrivatePem[keylen]; | |
| 37 | 37 | const publicKey = RSA_PublicPem[keylen]; | |
| 38 | - for (var i = 0; i < n; i++) { | ||
| 38 | + for (let i = 0; i < n; i++) { | ||
| 39 | 39 | const enc = crypto.privateEncrypt(privateKey, message); | |
| 40 | 40 | crypto.publicDecrypt(publicKey, enc); | |
| 41 | 41 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments