1 /* SHADRIVER.C - test driver for SHA-1 (and SHA-0)
2 * $FreeBSD: src/lib/libmd/shadriver.c,v 1.4 2005/03/09 19:23:04 cperciva Exp $
3 * $DragonFly: src/lib/libmd/shadriver.c,v 1.4 2008/09/11 20:25:34 swildner Exp $
6 /* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
9 RSA Data Security, Inc. makes no representations concerning either
10 the merchantability of this software or the suitability of this
11 software for any particular purpose. It is provided "as is"
12 without express or implied warranty of any kind.
14 These notices must be retained in any copies of any part of this
15 documentation and/or software.
18 /* The following makes SHA default to SHA-1 if it has not already been
19 defined with C compiler flags.
25 #include <sys/types.h>
34 #define SHA_Data SHA1_Data
36 #define SHA_Data SHA256_Data
38 #define SHA_Data SHA512_Data
41 /* Digests a string and prints the result.
43 static void SHAString (char *string
)
47 printf ("SHA-%d (\"%s\") = %s\n",
48 SHA
, string
, SHA_Data(string
,strlen(string
),buf
));
51 /* Digests a reference suite of strings and prints the results.
55 printf ("SHA-%d test suite:\n", SHA
);
59 SHAString ("message digest");
60 SHAString ("abcdefghijklmnopqrstuvwxyz");
62 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
64 ("1234567890123456789012345678901234567890\
65 1234567890123456789012345678901234567890");