xref: /freebsd-14.2/lib/libmd/rmddriver.c (revision 1d386b48)
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/cdefs.h>
15 #include <sys/types.h>
16 
17 #include <stdio.h>
18 #include <time.h>
19 #include <string.h>
20 
21 #include "ripemd.h"
22 
23 /* Digests a string and prints the result. */
24 static void
RIPEMD160String(char * string)25 RIPEMD160String(char *string)
26 {
27 	char buf[2*20 + 1];
28 
29 	printf("RIPEMD160 (\"%s\") = %s\n",
30 	       string, RIPEMD160_Data(string, strlen(string), buf));
31 }
32 
33 /* Digests a reference suite of strings and prints the results. */
34 int
main(void)35 main(void)
36 {
37 	printf("RIPEMD160 test suite:\n");
38 
39 	RIPEMD160String("");
40 	RIPEMD160String("abc");
41 	RIPEMD160String("message digest");
42 	RIPEMD160String("abcdefghijklmnopqrstuvwxyz");
43 	RIPEMD160String("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
44 		"abcdefghijklmnopqrstuvwxyz0123456789");
45 	RIPEMD160String("1234567890123456789012345678901234567890"
46 		"1234567890123456789012345678901234567890");
47 
48 	return 0;
49 }
50