1 /* SHADRIVER.C - test driver for SHA-1 (and SHA-0)
2 * $FreeBSD: src/lib/libmd/shadriver.c,v 1.2 1999/08/28 00:05:09 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 SHA default to SHA-1 if it has not already been
18 defined with C compiler flags.
24 #include <sys/types.h>
31 #define SHA_Data SHA1_Data
34 /* Digests a string and prints the result.
36 static void SHAString (string)
41 printf ("SHA-%d (\"%s\") = %s\n",
42 SHA, string, SHA_Data(string,strlen(string),buf));
45 /* Digests a reference suite of strings and prints the results.
49 printf ("SHA-%d test suite:\n", SHA);
53 SHAString ("message digest");
54 SHAString ("abcdefghijklmnopqrstuvwxyz");
56 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
58 ("1234567890123456789012345678901234567890\
59 1234567890123456789012345678901234567890");