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 #include <sys/types.h>
21 /* The following makes MD default to MD5 if it has not already been defined
22 * with C compiler flags. */
29 #define MDData MD2Data
33 #define MDData MD4Data
37 #define MDData MD5Data
40 /* Digests a string and prints the result. */
42 MDString(char *string)
46 printf("MD%d (\"%s\") = %s\n",
47 MD, string, MDData(string, strlen(string), buf));
50 /* Digests a reference suite of strings and prints the results. */
54 printf("MD%d test suite:\n", MD);
59 MDString("message digest");
60 MDString("abcdefghijklmnopqrstuvwxyz");
61 MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
62 "abcdefghijklmnopqrstuvwxyz0123456789");
63 MDString("1234567890123456789012345678901234567890"
64 "1234567890123456789012345678901234567890");