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

Function md2_test

extra/yassl/taocrypt/test/test.cpp:614–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612
613
614int md2_test()
615{
616 MD2 md5;
617 byte hash[MD2::DIGEST_SIZE];
618
619 testVector test_md2[] =
620 {
621 testVector("",
622 "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
623 "\x27\x73"),
624 testVector("a",
625 "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
626 "\xb5\xd1"),
627 testVector("abc",
628 "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
629 "\xd6\xbb"),
630 testVector("message digest",
631 "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
632 "\x06\xb0"),
633 testVector("abcdefghijklmnopqrstuvwxyz",
634 "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
635 "\x94\x0b"),
636 testVector("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
637 "0123456789",
638 "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
639 "\x38\xcd"),
640 testVector("12345678901234567890123456789012345678901234567890123456"
641 "789012345678901234567890",
642 "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
643 "\xef\xd8")
644 };
645
646 int times( sizeof(test_md2) / sizeof(testVector) );
647 for (int i = 0; i < times; ++i) {
648 md5.Update(test_md2[i].input_, test_md2[i].inLen_);
649 md5.Final(hash);
650
651 if (memcmp(hash, test_md2[i].output_, MD2::DIGEST_SIZE) != 0)
652 return -10 - i;
653 }
654
655 return 0;
656}
657
658
659int ripemd_test()

Callers 1

taocrypt_testFunction · 0.85

Calls 3

testVectorClass · 0.85
UpdateMethod · 0.45
FinalMethod · 0.45

Tested by

no test coverage detected