1 /* MDDRIVER.C - test driver for MD2, MD4 and MD5
2 * $FreeBSD: src/lib/libmd/mddriver.c,v 1.6 1999/08/28 00:05:07 peter Exp $
5 /* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
8 RSA Data Security, Inc. makes no representations concerning either
9 the merchantability of this software or the suitability of this
10 software for any particular purpose. It is provided "as is"
11 without express or implied warranty of any kind.
13 These notices must be retained in any copies of any part of this
14 documentation and/or software.
17 /* The following makes MD default to MD5 if it has not already been
18 defined with C compiler flags.
24 #include <sys/types.h>
31 #define MDData MD2Data
35 #define MDData MD4Data
39 #define MDData MD5Data
42 /* Digests a string and prints the result.
44 static void MDString (string)
49 printf ("MD%d (\"%s\") = %s\n",
50 MD, string, MDData(string,strlen(string),buf));
53 /* Digests a reference suite of strings and prints the results.
57 printf ("MD%d test suite:\n", MD);
62 MDString ("message digest");
63 MDString ("abcdefghijklmnopqrstuvwxyz");
65 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
67 ("1234567890123456789012345678901234567890\
68 1234567890123456789012345678901234567890");