MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / ACE_TMAIN

Function ACE_TMAIN

tests/DCPS/KeyTest/md5_test.cpp:21–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21int
22ACE_TMAIN(int, ACE_TCHAR*[])
23{
24 // Unit test of public domain MD5 Hash implementation
25 using OpenDDS::DCPS::MD5Hash;
26 unsigned char d[16];
27
28 {
29 const char *msg = "The quick brown fox jumps over the lazy dog.";
30 unsigned char expected[16] = { 0xe4, 0xd9, 0x09, 0xc2,
31 0x90, 0xd0, 0xfb, 0x1c,
32 0xa0, 0x68, 0xff, 0xad,
33 0xdf, 0x22, 0xcb, 0xd0 };
34 MD5Hash(d, msg, strlen(msg));
35 print_hex(d);
36 print_hex(expected);
37 TEST_CHECK(memcmp(expected, d, 16) == 0);
38 }
39
40 {
41 const char *msg = "";
42 unsigned char expected[16] = { 0xd4, 0x1d, 0x8c, 0xd9,
43 0x8f, 0x00, 0xb2, 0x04,
44 0xe9, 0x80, 0x09, 0x98,
45 0xec, 0xf8, 0x42, 0x7e };
46 MD5Hash(d, msg, strlen(msg));
47 print_hex(d);
48 print_hex(expected);
49 TEST_CHECK(memcmp(expected, d, 16) == 0);
50 }
51
52 {
53 const char *msg = "The quick brown fox jumps over the lazy dog";
54 unsigned char expected[16] = { 0x9e, 0x10, 0x7d, 0x9d,
55 0x37, 0x2b, 0xb6, 0x82,
56 0x6b, 0xd8, 0x1d, 0x35,
57 0x42, 0xa4, 0x19, 0xd6 };
58 MD5Hash(d, msg, strlen(msg));
59 print_hex(d);
60 print_hex(expected);
61 TEST_CHECK(memcmp(expected, d, 16) == 0);
62 }
63
64 return 0;
65}

Callers

nothing calls this directly

Calls 2

MD5HashFunction · 0.85
print_hexFunction · 0.70

Tested by

no test coverage detected