1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
14 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
15 uint8_t digest
[MD2_DIGEST_LENGTH
];
18 MD2Update(&ctx
, entropy
, __arraycount(entropy
));
19 MD2Final(digest
, &ctx
);
22 for (size_t i
= 0; i
< __arraycount(digest
); i
++)
23 printf("%02x", digest
[i
]);
29 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
30 char digest
[MD2_DIGEST_STRING_LENGTH
];
33 MD2Update(&ctx
, entropy
, __arraycount(entropy
));
34 char *p
= MD2End(&ctx
, digest
);
37 printf("test2: '%s'\n", digest
);
42 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
45 MD2Update(&ctx
, entropy
, __arraycount(entropy
));
46 char *p
= MD2End(&ctx
, NULL
);
47 assert(strlen(p
) == MD2_DIGEST_STRING_LENGTH
- 1);
49 printf("test3: '%s'\n", p
);
55 char digest
[MD2_DIGEST_STRING_LENGTH
];
57 char *p
= MD2File("/etc/fstab", digest
);
60 printf("test4: '%s'\n", p
);
64 char *p
= MD2File("/etc/fstab", NULL
);
65 assert(strlen(p
) == MD2_DIGEST_STRING_LENGTH
- 1);
67 printf("test5: '%s'\n", p
);
73 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
74 char digest
[MD2_DIGEST_STRING_LENGTH
];
76 char *p
= MD2Data(entropy
, __arraycount(entropy
), digest
);
79 printf("test6: '%s'\n", p
);
83 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
85 char *p
= MD2Data(entropy
, __arraycount(entropy
), NULL
);
86 assert(strlen(p
) == MD2_DIGEST_STRING_LENGTH
- 1);
88 printf("test7: '%s'\n", p
);
105 // CHECK: test1: 'e303e49b34f981c2740cdf809200d51b'
106 // CHECK: test2: 'e303e49b34f981c2740cdf809200d51b'
107 // CHECK: test3: 'e303e49b34f981c2740cdf809200d51b'
108 // CHECK: test4: '{{.*}}'
109 // CHECK: test5: '{{.*}}'
110 // CHECK: test6: 'e303e49b34f981c2740cdf809200d51b'
111 // CHECK: test7: 'e303e49b34f981c2740cdf809200d51b'