15 typedef unsigned char testBlock_t
[ALIGNMENTS
* LENGTHS
];
17 testBlock_t bss1
, bss2
;
19 unsigned char *start
[BLOCKTYPES
] = {
24 const char goodResult
[] = "7b405d24bc03195474c70ddae9e1f8fb";
26 void runTest(unsigned char *, unsigned char *);
29 main(int ac
, char **av
)
32 testBlock_t auto1
, auto2
;
39 for (i
= 0; i
< BLOCKTYPES
; ++i
)
40 for (j
= 0; j
< BLOCKTYPES
; ++j
)
42 runTest(start
[i
], start
[j
]);
44 return strcmp(result
, goodResult
);
47 void runTest(unsigned char *b1
, unsigned char *b2
)
52 for (i
= 0; i
< ALIGNMENTS
; ++i
) {
53 for (j
= 0; j
< ALIGNMENTS
; ++j
) {
54 k
= sizeof(testBlock_t
) - (i
> j
? i
: j
);
55 for (m
= 0; m
< k
; ++m
) {
56 for (n
= 0; n
< sizeof(testBlock_t
); ++n
) {
57 b1
[n
] = (unsigned char)random();
58 b2
[n
] = (unsigned char)random();
60 memcpy(b1
+ i
, b2
+ j
, m
);
61 MD5Update(mc
, b1
, sizeof(testBlock_t
));
62 MD5Update(mc
, b2
, sizeof(testBlock_t
));