1 /* MDDRIVER.C - test driver for MD2, MD4 and MD5 */
3 /* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights
6 * RSA Data Security, Inc. makes no representations concerning either the
7 * merchantability of this software or the suitability of this software for
8 * any particular purpose. It is provided "as is" without express or implied
9 * warranty of any kind.
11 * These notices must be retained in any copies of any part of this
12 * documentation and/or software. */
14 #include <sys/cdefs.h>
15 __FBSDID("$FreeBSD$");
17 #include <sys/types.h>
23 /* The following makes MD default to MD5 if it has not already been defined
24 * with C compiler flags. */
31 #define MDData MD2Data
35 #define MDData MD4Data
39 #define MDData MD5Data
42 /* Digests a string and prints the result. */
44 MDString(char *string)
48 printf("MD%d (\"%s\") = %s\n",
49 MD, string, MDData(string, strlen(string), buf));
52 /* Digests a reference suite of strings and prints the results. */
56 printf("MD%d test suite:\n", MD);
61 MDString("message digest");
62 MDString("abcdefghijklmnopqrstuvwxyz");
63 MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
64 "abcdefghijklmnopqrstuvwxyz0123456789");
65 MDString("1234567890123456789012345678901234567890"
66 "1234567890123456789012345678901234567890");