| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -351,15 +351,13 @@ if (!common.hasFipsCrypto) { | |||
| 351 | 351 | const a0 = crypto.createHash('md5').update('Test123').digest('latin1'); | |
| 352 | 352 | assert.strictEqual( | |
| 353 | 353 | a0, | |
| 354 | - 'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c', | ||
| 355 | - 'Test MD5 as latin1' | ||
| 354 | + 'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c' | ||
| 356 | 355 | ); | |
| 357 | 356 | } | |
| 358 | 357 | ||
| 359 | - assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); | ||
| 358 | + assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2'); | ||
| 360 | 359 | ||
| 361 | - assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=', | ||
| 362 | - 'Test SHA256 as base64'); | ||
| 360 | + assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4='); | ||
| 363 | 361 | ||
| 364 | 362 | assert.strictEqual( | |
| 365 | 363 | a3, | |
@@ -373,14 +371,13 @@ assert.strictEqual( | |||
| 373 | 371 | ||
| 374 | 372 | assert.deepStrictEqual( | |
| 375 | 373 | a4, | |
| 376 | - Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex'), | ||
| 377 | - 'Test SHA1' | ||
| 374 | + Buffer.from('8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'hex') | ||
| 378 | 375 | ); | |
| 379 | 376 | ||
| 380 | 377 | // Test multiple updates to same hash | |
| 381 | 378 | const h1 = crypto.createHash('sha1').update('Test123').digest('hex'); | |
| 382 | 379 | const h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex'); | |
| 383 | - assert.strictEqual(h1, h2, 'multipled updates'); | ||
| 380 | + assert.strictEqual(h1, h2); | ||
| 384 | 381 | ||
| 385 | 382 | // Test hashing for binary files | |
| 386 | 383 | const fn = fixtures.path('sample.png'); | |
@@ -392,8 +389,7 @@ fileStream.on('data', function(data) { | |||
| 392 | 389 | fileStream.on('close', common.mustCall(function() { | |
| 393 | 390 | assert.strictEqual( | |
| 394 | 391 | sha1Hash.digest('hex'), | |
| 395 | - '22723e553129a336ad96e10f6aecdf0f45e4149e', | ||
| 396 | - 'Test SHA1 of sample.png' | ||
| 392 | + '22723e553129a336ad96e10f6aecdf0f45e4149e' | ||
| 397 | 393 | ); | |
| 398 | 394 | })); | |
| 399 | 395 | ||
@@ -410,7 +406,7 @@ const s1Verified = crypto.createVerify('SHA1') | |||
| 410 | 406 | .update('Test') | |
| 411 | 407 | .update('123') | |
| 412 | 408 | .verify(certPem, s1, 'base64'); | |
| 413 | - assert.strictEqual(s1Verified, true, 'sign and verify (base 64)'); | ||
| 409 | + assert.strictEqual(s1Verified, true); | ||
| 414 | 410 | ||
| 415 | 411 | const s2 = crypto.createSign('SHA256') | |
| 416 | 412 | .update('Test123') | |
@@ -419,7 +415,7 @@ const s2Verified = crypto.createVerify('SHA256') | |||
| 419 | 415 | .update('Test') | |
| 420 | 416 | .update('123') | |
| 421 | 417 | .verify(certPem, s2); // binary | |
| 422 | - assert.strictEqual(s2Verified, true, 'sign and verify (binary)'); | ||
| 418 | + assert.strictEqual(s2Verified, true); | ||
| 423 | 419 | ||
| 424 | 420 | const s3 = crypto.createSign('SHA1') | |
| 425 | 421 | .update('Test123') | |
@@ -428,7 +424,7 @@ const s3Verified = crypto.createVerify('SHA1') | |||
| 428 | 424 | .update('Test') | |
| 429 | 425 | .update('123') | |
| 430 | 426 | .verify(certPem, s3); | |
| 431 | - assert.strictEqual(s3Verified, true, 'sign and verify (buffer)'); | ||
| 427 | + assert.strictEqual(s3Verified, true); | ||
| 432 | 428 | ||
| 433 | 429 | ||
| 434 | 430 | function testCipher1(key) { | |
@@ -446,7 +442,7 @@ function testCipher1(key) { | |||
| 446 | 442 | let txt = decipher.update(ciph, 'hex', 'utf8'); | |
| 447 | 443 | txt += decipher.final('utf8'); | |
| 448 | 444 | ||
| 449 | - assert.strictEqual(txt, plaintext, 'encryption and decryption'); | ||
| 445 | + assert.strictEqual(txt, plaintext); | ||
| 450 | 446 | } | |
| 451 | 447 | ||
| 452 | 448 | ||
@@ -468,7 +464,7 @@ function testCipher2(key) { | |||
| 468 | 464 | let txt = decipher.update(ciph, 'base64', 'utf8'); | |
| 469 | 465 | txt += decipher.final('utf8'); | |
| 470 | 466 | ||
| 471 | - assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64'); | ||
| 467 | + assert.strictEqual(txt, plaintext); | ||
| 472 | 468 | } | |
| 473 | 469 | ||
| 474 | 470 | ||
@@ -486,8 +482,7 @@ function testCipher3(key, iv) { | |||
| 486 | 482 | let txt = decipher.update(ciph, 'hex', 'utf8'); | |
| 487 | 483 | txt += decipher.final('utf8'); | |
| 488 | 484 | ||
| 489 | - assert.strictEqual(txt, plaintext, | ||
| 490 | - 'encryption and decryption with key and iv'); | ||
| 485 | + assert.strictEqual(txt, plaintext); | ||
| 491 | 486 | } | |
| 492 | 487 | ||
| 493 | 488 | ||
@@ -505,8 +500,7 @@ function testCipher4(key, iv) { | |||
| 505 | 500 | let txt = decipher.update(ciph, 'buffer', 'utf8'); | |
| 506 | 501 | txt += decipher.final('utf8'); | |
| 507 | 502 | ||
| 508 | - assert.strictEqual(txt, plaintext, | ||
| 509 | - 'encryption and decryption with key and iv'); | ||
| 503 | + assert.strictEqual(txt, plaintext); | ||
| 510 | 504 | } | |
| 511 | 505 | ||
| 512 | 506 | ||
@@ -524,8 +518,7 @@ function testCipher5(key, iv) { | |||
| 524 | 518 | let txt = decipher.update(ciph, 'buffer', 'utf8'); | |
| 525 | 519 | txt += decipher.final('utf8'); | |
| 526 | 520 | ||
| 527 | - assert.strictEqual(txt, plaintext, | ||
| 528 | - 'encryption and decryption with key'); | ||
| 521 | + assert.strictEqual(txt, plaintext); | ||
| 529 | 522 | } | |
| 530 | 523 | ||
| 531 | 524 | if (!common.hasFipsCrypto) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments