MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / sha512_test

Function sha512_test

extra/yassl/taocrypt/test/test.cpp:432–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430#ifdef WORD64_AVAILABLE
431
432int sha512_test()
433{
434 SHA512 sha;
435 byte hash[SHA512::DIGEST_SIZE];
436
437 testVector test_sha[] =
438 {
439 testVector("abc",
440 "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41"
441 "\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55"
442 "\xd3\x9a\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3"
443 "\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f"
444 "\xa5\x4c\xa4\x9f"),
445 testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
446 "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
447 "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14"
448 "\x3f\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88"
449 "\x90\x18\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4"
450 "\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
451 "\x87\x4b\xe9\x09")
452 };
453
454 int times( sizeof(test_sha) / sizeof(testVector) );
455 for (int i = 0; i < times; ++i) {
456 sha.Update(test_sha[i].input_, test_sha[i].inLen_);
457 sha.Final(hash);
458
459 if (memcmp(hash, test_sha[i].output_, SHA512::DIGEST_SIZE) != 0)
460 return -1 - i;
461 }
462
463 return 0;
464}
465
466
467int sha384_test()

Callers 1

taocrypt_testFunction · 0.85

Calls 3

testVectorClass · 0.85
UpdateMethod · 0.45
FinalMethod · 0.45

Tested by

no test coverage detected