8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89feb8d commit 57d48acCopy full SHA for 57d48ac
test/parallel/test-crypto-ecb.js
@@ -1,6 +1,6 @@
1
'use strict';
2
-var common = require('../common');
3
-var assert = require('assert');
+const common = require('../common');
+const assert = require('assert');
4
5
if (!common.hasCrypto) {
6
common.skip('missing crypto');
@@ -10,24 +10,25 @@ if (common.hasFipsCrypto) {
10
common.skip('BF-ECB is not FIPS 140-2 compatible');
11
return;
12
}
13
-var crypto = require('crypto');
+const crypto = require('crypto');
14
15
crypto.DEFAULT_ENCODING = 'buffer';
16
17
// Testing whether EVP_CipherInit_ex is functioning correctly.
18
// Reference: bug#1997
19
20
-(function() {
21
- var encrypt = crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', '');
22
- var hex = encrypt.update('Hello World!', 'ascii', 'hex');
+{
+ const encrypt =
+ crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', '');
23
+ let hex = encrypt.update('Hello World!', 'ascii', 'hex');
24
hex += encrypt.final('hex');
25
assert.strictEqual(hex.toUpperCase(), '6D385F424AAB0CFBF0BB86E07FFB7D71');
-}());
26
+}
27
28
- var decrypt = crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR',
29
- '');
30
- var msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii');
+ const decrypt =
+ crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', '');
31
+ let msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii');
32
msg += decrypt.final('ascii');
33
assert.strictEqual(msg, 'Hello World!');
34