1 // RUN: %clangxx -O0 -g %s -o %t -lmd && %run %t 2>&1 | FileCheck %s
13 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
14 uint8_t digest
[MD5_DIGEST_LENGTH
];
15 size_t entropysz
= sizeof(entropy
);
16 size_t digestsz
= sizeof(digest
);
19 MD5Update(&ctx
, entropy
, entropysz
);
20 MD5Final(digest
, &ctx
);
23 for (size_t i
= 0; i
< digestsz
; i
++)
24 printf("%02x", digest
[i
]);
30 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
31 char digest
[MD5_DIGEST_STRING_LENGTH
];
32 size_t entropysz
= sizeof(entropy
);
35 MD5Update(&ctx
, entropy
, entropysz
);
36 char *p
= MD5End(&ctx
, digest
);
39 printf("test2: '%s'\n", digest
);
44 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
45 size_t entropysz
= sizeof(entropy
);
48 MD5Update(&ctx
, entropy
, entropysz
);
49 char *p
= MD5End(&ctx
, NULL
);
50 assert(strlen(p
) == MD5_DIGEST_STRING_LENGTH
- 1);
52 printf("test3: '%s'\n", p
);
58 char digest
[MD5_DIGEST_STRING_LENGTH
];
60 char *p
= MD5File("/etc/fstab", digest
);
63 printf("test4: '%s'\n", p
);
67 char *p
= MD5File("/etc/fstab", NULL
);
68 assert(strlen(p
) == MD5_DIGEST_STRING_LENGTH
- 1);
70 printf("test5: '%s'\n", p
);
76 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
77 char digest
[MD5_DIGEST_STRING_LENGTH
];
78 size_t entropysz
= sizeof(entropy
);
80 char *p
= MD5Data(entropy
, entropysz
, digest
);
83 printf("test6: '%s'\n", p
);
87 uint8_t entropy
[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
88 size_t entropysz
= sizeof(entropy
);
90 char *p
= MD5Data(entropy
, entropysz
, NULL
);
91 assert(strlen(p
) == MD5_DIGEST_STRING_LENGTH
- 1);
93 printf("test7: '%s'\n", p
);
110 // CHECK: test1: '86e65b1ef4a830af347ac05ab4f0e999'
111 // CHECK: test2: '86e65b1ef4a830af347ac05ab4f0e999'
112 // CHECK: test3: '86e65b1ef4a830af347ac05ab4f0e999'
113 // CHECK: test4: '{{.*}}'
114 // CHECK: test5: '{{.*}}'
115 // CHECK: test6: '86e65b1ef4a830af347ac05ab4f0e999'
116 // CHECK: test7: '86e65b1ef4a830af347ac05ab4f0e999'