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