]>
git.ipfire.org Git - thirdparty/squid.git/blob - lib/md5-test.c
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
12 static void MDPrint(unsigned char digest
[16]);
13 static void MDString(char *string
);
16 MDString(char *string
)
19 unsigned char digest
[16];
20 unsigned int len
= strlen(string
);
22 xMD5Update(&context
, string
, len
);
23 xMD5Final(digest
, &context
);
24 printf("MD5 (\"%s\") = ", string
);
30 MDPrint(unsigned char digest
[16])
33 for (i
= 0; i
< 16; i
++)
34 printf("%02x", digest
[i
]);
38 main(int argc
, char **argv
)
40 printf("MD5 test suite:\n");
44 MDString("message digest");
45 MDString("abcdefghijklmnopqrstuvwxyz");
46 MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
47 MDString("1234567890123456789012345678901234567890"
48 "1234567890123456789012345678901234567890");