1331722Seadler/* RIPEMD160DRIVER.C - test driver for RIPEMD160 */
21590Srgrimes
31590Srgrimes/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights
41590Srgrimes * reserved.
51590Srgrimes *
61590Srgrimes * RSA Data Security, Inc. makes no representations concerning either the
71590Srgrimes * merchantability of this software or the suitability of this software for
81590Srgrimes * any particular purpose. It is provided "as is" without express or implied
91590Srgrimes * warranty of any kind.
101590Srgrimes *
111590Srgrimes * These notices must be retained in any copies of any part of this
121590Srgrimes * documentation and/or software. */
131590Srgrimes
141590Srgrimes#include <sys/cdefs.h>
151590Srgrimes__FBSDID("$FreeBSD: releng/10.3/lib/libmd/rmddriver.c 220496 2011-04-09 13:56:29Z markm $");
161590Srgrimes
171590Srgrimes#include <sys/types.h>
181590Srgrimes
191590Srgrimes#include <stdio.h>
201590Srgrimes#include <time.h>
211590Srgrimes#include <string.h>
221590Srgrimes
231590Srgrimes#include "ripemd.h"
241590Srgrimes
251590Srgrimes/* Digests a string and prints the result. */
261590Srgrimesstatic void
271590SrgrimesRIPEMD160String(char *string)
281590Srgrimes{
29216370Sjoel	char buf[2*20 + 1];
30216370Sjoel
311590Srgrimes	printf("RIPEMD160 (\"%s\") = %s\n",
321590Srgrimes	       string, RIPEMD160_Data(string, strlen(string), buf));
331590Srgrimes}
341590Srgrimes
351590Srgrimes/* Digests a reference suite of strings and prints the results. */
361590Srgrimesint
371590Srgrimesmain(void)
381590Srgrimes{
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}
52