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

Function md4_test

extra/yassl/taocrypt/test/test.cpp:569–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567
568
569int md4_test()
570{
571 MD4 md4;
572 byte hash[MD4::DIGEST_SIZE];
573
574 testVector test_md4[] =
575 {
576 testVector("",
577 "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89"
578 "\xc0"),
579 testVector("a",
580 "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb"
581 "\x24"),
582 testVector("abc",
583 "\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72"
584 "\x9d"),
585 testVector("message digest",
586 "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01"
587 "\x4b"),
588 testVector("abcdefghijklmnopqrstuvwxyz",
589 "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d"
590 "\xa9"),
591 testVector("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
592 "6789",
593 "\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0"
594 "\xe4"),
595 testVector("1234567890123456789012345678901234567890123456789012345678"
596 "9012345678901234567890",
597 "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05"
598 "\x36")
599 };
600
601 int times( sizeof(test_md4) / sizeof(testVector) );
602 for (int i = 0; i < times; ++i) {
603 md4.Update(test_md4[i].input_, test_md4[i].inLen_);
604 md4.Final(hash);
605
606 if (memcmp(hash, test_md4[i].output_, MD4::DIGEST_SIZE) != 0)
607 return -5 - i;
608 }
609
610 return 0;
611}
612
613
614int md2_test()

Callers 1

taocrypt_testFunction · 0.85

Calls 3

testVectorClass · 0.85
UpdateMethod · 0.45
FinalMethod · 0.45

Tested by

no test coverage detected