| 465 | |
| 466 | |
| 467 | int sha384_test() |
| 468 | { |
| 469 | SHA384 sha; |
| 470 | byte hash[SHA384::DIGEST_SIZE]; |
| 471 | |
| 472 | testVector test_sha[] = |
| 473 | { |
| 474 | testVector("abc", |
| 475 | "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50" |
| 476 | "\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff" |
| 477 | "\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34" |
| 478 | "\xc8\x25\xa7"), |
| 479 | testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi" |
| 480 | "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", |
| 481 | "\x09\x33\x0c\x33\xf7\x11\x47\xe8\x3d\x19\x2f\xc7\x82\xcd\x1b" |
| 482 | "\x47\x53\x11\x1b\x17\x3b\x3b\x05\xd2\x2f\xa0\x80\x86\xe3\xb0" |
| 483 | "\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91" |
| 484 | "\x74\x60\x39") |
| 485 | }; |
| 486 | |
| 487 | int times( sizeof(test_sha) / sizeof(testVector) ); |
| 488 | for (int i = 0; i < times; ++i) { |
| 489 | sha.Update(test_sha[i].input_, test_sha[i].inLen_); |
| 490 | sha.Final(hash); |
| 491 | |
| 492 | if (memcmp(hash, test_sha[i].output_, SHA384::DIGEST_SIZE) != 0) |
| 493 | return -1 - i; |
| 494 | } |
| 495 | |
| 496 | return 0; |
| 497 | } |
| 498 | |
| 499 | #endif // WORD64_AVAILABLE |
| 500 |
no test coverage detected