Explicitly specify `all' as the default target(as it used to be), so as
[dragonfly.git] / lib / libmd / shadriver.c
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 $
3  * $DragonFly: src/lib/libmd/shadriver.c,v 1.2 2003/06/17 04:26:50 dillon Exp $
4  */
5
6 /* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
7    rights reserved.
8
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.
13
14    These notices must be retained in any copies of any part of this
15    documentation and/or software.
16  */
17
18 /* The following makes SHA default to SHA-1 if it has not already been
19      defined with C compiler flags.
20  */
21 #ifndef SHA
22 #define SHA 1
23 #endif
24
25 #include <sys/types.h>
26
27 #include <stdio.h>
28 #include <time.h>
29 #include <string.h>
30 #include "sha.h"
31 #if SHA == 1
32 #define SHA_Data SHA1_Data
33 #endif
34
35 /* Digests a string and prints the result.
36  */
37 static void SHAString (string)
38 char *string;
39 {
40   char buf[2*20+1];
41
42   printf ("SHA-%d (\"%s\") = %s\n", 
43         SHA, string, SHA_Data(string,strlen(string),buf));
44 }
45
46 /* Digests a reference suite of strings and prints the results.
47  */
48 main()
49 {
50   printf ("SHA-%d test suite:\n", SHA);
51
52   SHAString ("");
53   SHAString ("abc");
54   SHAString ("message digest");
55   SHAString ("abcdefghijklmnopqrstuvwxyz");
56   SHAString
57     ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
58   SHAString
59     ("1234567890123456789012345678901234567890\
60 1234567890123456789012345678901234567890");
61   return 0;
62 }