| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 503167b commit 59f6430
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,10 +13,10 @@ var crypto = require('crypto'); | |||
| 13 | 13 | // | |
| 14 | 14 | function testPBKDF2(password, salt, iterations, keylen, expected) { | |
| 15 | 15 | var actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); | |
| 16 | - assert.equal(actual.toString('latin1'), expected); | ||
| 16 | + assert.strictEqual(actual.toString('latin1'), expected); | ||
| 17 | 17 | ||
| 18 | 18 | crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', (err, actual) => { | |
| 19 | - assert.equal(actual.toString('latin1'), expected); | ||
| 19 | + assert.strictEqual(actual.toString('latin1'), expected); | ||
| 20 | 20 | }); | |
| 21 | 21 | } | |
| 22 | 22 | ||
@@ -47,43 +47,43 @@ testPBKDF2('pass\0word', 'sa\0lt', 4096, 16, | |||
| 47 | 47 | var expected = | |
| 48 | 48 | '64c486c55d30d4c5a079b8823b7d7cb37ff0556f537da8410233bcec330ed956'; | |
| 49 | 49 | var key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); | |
| 50 | - assert.equal(key.toString('hex'), expected); | ||
| 50 | + assert.strictEqual(key.toString('hex'), expected); | ||
| 51 | 51 | ||
| 52 | 52 | crypto.pbkdf2('password', 'salt', 32, 32, 'sha256', common.mustCall(ondone)); | |
| 53 | 53 | function ondone(err, key) { | |
| 54 | 54 | if (err) throw err; | |
| 55 | - assert.equal(key.toString('hex'), expected); | ||
| 55 | + assert.strictEqual(key.toString('hex'), expected); | ||
| 56 | 56 | } | |
| 57 | 57 | ||
| 58 | 58 | // Error path should not leak memory (check with valgrind). | |
| 59 | 59 | assert.throws(function() { | |
| 60 | 60 | crypto.pbkdf2('password', 'salt', 1, 20, null); | |
| 61 | - }); | ||
| 61 | + }, /^Error: No callback provided to pbkdf2$/); | ||
| 62 | 62 | ||
| 63 | 63 | // Should not work with Infinity key length | |
| 64 | 64 | assert.throws(function() { | |
| 65 | 65 | crypto.pbkdf2('password', 'salt', 1, Infinity, 'sha256', common.fail); | |
| 66 | - }, /Bad key length/); | ||
| 66 | + }, /^TypeError: Bad key length$/); | ||
| 67 | 67 | ||
| 68 | 68 | // Should not work with negative Infinity key length | |
| 69 | 69 | assert.throws(function() { | |
| 70 | 70 | crypto.pbkdf2('password', 'salt', 1, -Infinity, 'sha256', common.fail); | |
| 71 | - }, /Bad key length/); | ||
| 71 | + }, /^TypeError: Bad key length$/); | ||
| 72 | 72 | ||
| 73 | 73 | // Should not work with NaN key length | |
| 74 | 74 | assert.throws(function() { | |
| 75 | 75 | crypto.pbkdf2('password', 'salt', 1, NaN, 'sha256', common.fail); | |
| 76 | - }, /Bad key length/); | ||
| 76 | + }, /^TypeError: Bad key length$/); | ||
| 77 | 77 | ||
| 78 | 78 | // Should not work with negative key length | |
| 79 | 79 | assert.throws(function() { | |
| 80 | 80 | crypto.pbkdf2('password', 'salt', 1, -1, 'sha256', common.fail); | |
| 81 | - }, /Bad key length/); | ||
| 81 | + }, /^TypeError: Bad key length$/); | ||
| 82 | 82 | ||
| 83 | 83 | // Should not work with key length that does not fit into 32 signed bits | |
| 84 | 84 | assert.throws(function() { | |
| 85 | 85 | crypto.pbkdf2('password', 'salt', 1, 4073741824, 'sha256', common.fail); | |
| 86 | - }, /Bad key length/); | ||
| 86 | + }, /^TypeError: Bad key length$/); | ||
| 87 | 87 | ||
| 88 | 88 | // Should not get FATAL ERROR with empty password and salt | |
| 89 | 89 | // https://github.com/nodejs/node/issues/8571 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments