|
1 | 1 | 'use strict';
|
2 |
| -var common = require('../common'); |
3 |
| -var assert = require('assert'); |
| 2 | +const common = require('../common'); |
| 3 | +const assert = require('assert'); |
4 | 4 |
|
5 | 5 | if (!common.hasCrypto) {
|
6 | 6 | common.skip('missing crypto');
|
7 | 7 | return;
|
8 | 8 | }
|
9 |
| -var crypto = require('crypto'); |
| 9 | +const crypto = require('crypto'); |
10 | 10 |
|
11 | 11 | //
|
12 | 12 | // Test PBKDF2 with RFC 6070 test vectors (except #4)
|
13 | 13 | //
|
14 | 14 | function testPBKDF2(password, salt, iterations, keylen, expected) {
|
15 |
| - var actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); |
| 15 | + const actual = |
| 16 | + crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); |
16 | 17 | assert.strictEqual(actual.toString('latin1'), expected);
|
17 | 18 |
|
18 | 19 | crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', (err, actual) => {
|
@@ -44,9 +45,9 @@ testPBKDF2('pass\0word', 'sa\0lt', 4096, 16,
|
44 | 45 | '\x89\xb6\x9d\x05\x16\xf8\x29\x89\x3c\x69\x62\x26\x65' +
|
45 | 46 | '\x0a\x86\x87');
|
46 | 47 |
|
47 |
| -var expected = |
| 48 | +const expected = |
48 | 49 | '64c486c55d30d4c5a079b8823b7d7cb37ff0556f537da8410233bcec330ed956';
|
49 |
| -var key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); |
| 50 | +const key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); |
50 | 51 | assert.strictEqual(key.toString('hex'), expected);
|
51 | 52 |
|
52 | 53 | crypto.pbkdf2('password', 'salt', 32, 32, 'sha256', common.mustCall(ondone));
|
|
0 commit comments