summaryrefslogtreecommitdiff
path: root/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-09-13 22:48:53 -0300
committerRuben Bridgewater <ruben@bridgewater.de>2017-09-19 21:14:38 -0300
commite167ab71fb113fa38866dd11aa99af7079fb463c (patch)
tree3d91ca0f6e60d08fcab70833b851335e41b53cd0 /benchmark/crypto/rsa-encrypt-decrypt-throughput.js
parentb1c8f15c5f169e021f7c46eb7b219de95fe97603 (diff)
downloadnode-new-e167ab71fb113fa38866dd11aa99af7079fb463c.tar.gz
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'benchmark/crypto/rsa-encrypt-decrypt-throughput.js')
-rw-r--r--benchmark/crypto/rsa-encrypt-decrypt-throughput.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
index b1fc339366..edab5ae08f 100644
--- a/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
+++ b/benchmark/crypto/rsa-encrypt-decrypt-throughput.js
@@ -1,13 +1,13 @@
'use strict';
// throughput benchmark in signing and verifying
-var common = require('../common.js');
-var crypto = require('crypto');
-var fs = require('fs');
-var path = require('path');
-var fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
-var keylen_list = ['1024', '2048', '4096'];
-var RSA_PublicPem = {};
-var RSA_PrivatePem = {};
+const common = require('../common.js');
+const crypto = require('crypto');
+const fs = require('fs');
+const path = require('path');
+const fixtures_keydir = path.resolve(__dirname, '../../test/fixtures/keys/');
+const keylen_list = ['1024', '2048', '4096'];
+const RSA_PublicPem = {};
+const RSA_PrivatePem = {};
keylen_list.forEach(function(key) {
RSA_PublicPem[key] =
@@ -16,27 +16,27 @@ keylen_list.forEach(function(key) {
fs.readFileSync(`${fixtures_keydir}/rsa_private_${key}.pem`);
});
-var bench = common.createBenchmark(main, {
+const bench = common.createBenchmark(main, {
n: [500],
keylen: keylen_list,
len: [16, 32, 64]
});
function main(conf) {
- var message = Buffer.alloc(conf.len, 'b');
+ const message = Buffer.alloc(conf.len, 'b');
bench.start();
StreamWrite(conf.algo, conf.keylen, message, conf.n, conf.len);
}
function StreamWrite(algo, keylen, message, n, len) {
- var written = n * len;
- var bits = written * 8;
- var kbits = bits / (1024);
+ const written = n * len;
+ const bits = written * 8;
+ const kbits = bits / (1024);
- var privateKey = RSA_PrivatePem[keylen];
- var publicKey = RSA_PublicPem[keylen];
+ const privateKey = RSA_PrivatePem[keylen];
+ const publicKey = RSA_PublicPem[keylen];
for (var i = 0; i < n; i++) {
- var enc = crypto.privateEncrypt(privateKey, message);
+ const enc = crypto.privateEncrypt(privateKey, message);
crypto.publicDecrypt(publicKey, enc);
}