mddriver.c (1803) | mddriver.c (9488) |
---|---|
1/* MDDRIVER.C - test driver for MD2, MD4 and MD5 | 1/* MDDRIVER.C - test driver for MD2, MD4 and MD5 |
2 * $FreeBSD: head/lib/libmd/mddriver.c 1803 1994-07-24 03:29:56Z phk $ | 2 * $FreeBSD: head/lib/libmd/mddriver.c 9488 1995-07-12 09:13:49Z phk $ |
3 */ 4 5/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All 6 rights reserved. 7 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" --- 26 unchanged lines hidden (view full) --- 37#define MDData MD5Data 38#endif 39 40/* Digests a string and prints the result. 41 */ 42static void MDString (string) 43char *string; 44{ | 3 */ 4 5/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All 6 rights reserved. 7 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" --- 26 unchanged lines hidden (view full) --- 37#define MDData MD5Data 38#endif 39 40/* Digests a string and prints the result. 41 */ 42static void MDString (string) 43char *string; 44{ |
45 char buf[33]; |
|
45 | 46 |
46 printf ("MD%d (\"%s\") = %s\n", MD, string, MDData(string,strlen(string))); | 47 printf ("MD%d (\"%s\") = %s\n", 48 MD, string, MDData(string,strlen(string),buf)); |
47} 48 49/* Digests a reference suite of strings and prints the results. 50 */ 51main() 52{ 53 printf ("MD%d test suite:\n", MD); 54 55 MDString (""); 56 MDString ("a"); 57 MDString ("abc"); 58 MDString ("message digest"); 59 MDString ("abcdefghijklmnopqrstuvwxyz"); 60 MDString 61 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); 62 MDString 63 ("1234567890123456789012345678901234567890\ 641234567890123456789012345678901234567890"); 65} | 49} 50 51/* Digests a reference suite of strings and prints the results. 52 */ 53main() 54{ 55 printf ("MD%d test suite:\n", MD); 56 57 MDString (""); 58 MDString ("a"); 59 MDString ("abc"); 60 MDString ("message digest"); 61 MDString ("abcdefghijklmnopqrstuvwxyz"); 62 MDString 63 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); 64 MDString 65 ("1234567890123456789012345678901234567890\ 661234567890123456789012345678901234567890"); 67} |