xref: /freebsd/lib/libmd/rmddriver.c (revision 4b9d6057)
1 /* RIPEMD160DRIVER.C - test driver for RIPEMD160 */
2 
3 /* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights
4  * reserved.
5  *
6  * RSA Data Security, Inc. makes no representations concerning either the
7  * merchantability of this software or the suitability of this software for
8  * any particular purpose. It is provided "as is" without express or implied
9  * warranty of any kind.
10  *
11  * These notices must be retained in any copies of any part of this
12  * documentation and/or software. */
13 
14 #include <sys/types.h>
15 
16 #include <stdio.h>
17 #include <time.h>
18 #include <string.h>
19 
20 #include "ripemd.h"
21 
22 /* Digests a string and prints the result. */
23 static void
24 RIPEMD160String(char *string)
25 {
26 	char buf[2*20 + 1];
27 
28 	printf("RIPEMD160 (\"%s\") = %s\n",
29 	       string, RIPEMD160_Data(string, strlen(string), buf));
30 }
31 
32 /* Digests a reference suite of strings and prints the results. */
33 int
34 main(void)
35 {
36 	printf("RIPEMD160 test suite:\n");
37 
38 	RIPEMD160String("");
39 	RIPEMD160String("abc");
40 	RIPEMD160String("message digest");
41 	RIPEMD160String("abcdefghijklmnopqrstuvwxyz");
42 	RIPEMD160String("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
43 		"abcdefghijklmnopqrstuvwxyz0123456789");
44 	RIPEMD160String("1234567890123456789012345678901234567890"
45 		"1234567890123456789012345678901234567890");
46 
47 	return 0;
48 }
49