Deleted Added
full compact
md5.c (88226) md5.c (109870)
1/*
2 * Derived from:
3 *
4 * MDDRIVER.C - test driver for MD2, MD4 and MD5
5 */
6
7/*
8 * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All

--- 5 unchanged lines hidden (view full) ---

14 * without express or implied warranty of any kind.
15 *
16 * These notices must be retained in any copies of any part of this
17 * documentation and/or software.
18 */
19
20#ifndef lint
21static const char rcsid[] =
1/*
2 * Derived from:
3 *
4 * MDDRIVER.C - test driver for MD2, MD4 and MD5
5 */
6
7/*
8 * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All

--- 5 unchanged lines hidden (view full) ---

14 * without express or implied warranty of any kind.
15 *
16 * These notices must be retained in any copies of any part of this
17 * documentation and/or software.
18 */
19
20#ifndef lint
21static const char rcsid[] =
22 "$FreeBSD: head/sbin/md5/md5.c 88226 2001-12-19 21:19:43Z phk $";
22 "$FreeBSD: head/sbin/md5/md5.c 109870 2003-01-26 08:23:37Z silby $";
23#endif /* not lint */
24
25#include <sys/types.h>
26#include <err.h>
27#include <md5.h>
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>

--- 133 unchanged lines hidden (view full) ---

164 * Anderson, ric@Artisoft.COM.) */
165 printf
166 ("Speed = %ld bytes/second\n",
167 (long) TEST_BLOCK_LEN * (long) TEST_BLOCK_COUNT / ((endTime - startTime) != 0 ? (long)(endTime - startTime) : 1));
168}
169/*
170 * Digests a reference suite of strings and prints the results.
171 */
23#endif /* not lint */
24
25#include <sys/types.h>
26#include <err.h>
27#include <md5.h>
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>

--- 133 unchanged lines hidden (view full) ---

164 * Anderson, ric@Artisoft.COM.) */
165 printf
166 ("Speed = %ld bytes/second\n",
167 (long) TEST_BLOCK_LEN * (long) TEST_BLOCK_COUNT / ((endTime - startTime) != 0 ? (long)(endTime - startTime) : 1));
168}
169/*
170 * Digests a reference suite of strings and prints the results.
171 */
172
173#define MD5TESTCOUNT 8
174
175char *MDTestInput[] = {
176 "",
177 "a",
178 "abc",
179 "message digest",
180 "abcdefghijklmnopqrstuvwxyz",
181 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
182 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
183 "MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt"
184};
185
186char *MDTestOutput[MD5TESTCOUNT] = {
187 "d41d8cd98f00b204e9800998ecf8427e",
188 "0cc175b9c0f1b6a831c399e269772661",
189 "900150983cd24fb0d6963f7d28e17f72",
190 "f96b697d7cb7938d525a2f31aaf161d0",
191 "c3fcd3d76192e4007dfb496cca67e13b",
192 "d174ab98d277d9f5a5611c2c9f419d9f",
193 "57edf4a22be3c955ac49da2e2107b67a",
194 "b50663f41d44d92171cb9976bc118538"
195};
196
172static void
173MDTestSuite(void)
174{
197static void
198MDTestSuite(void)
199{
200 int i;
201 char buffer[33];
175
176 printf("MD5 test suite:\n");
202
203 printf("MD5 test suite:\n");
177
178 MDString("");
179 MDString("a");
180 MDString("abc");
181 MDString("message digest");
182 MDString("abcdefghijklmnopqrstuvwxyz");
183 MDString
184 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
185 MDString
186 ("1234567890123456789012345678901234567890\
1871234567890123456789012345678901234567890");
204 for (i = 0; i < MD5TESTCOUNT; i++) {
205 MD5Data(MDTestInput[i], strlen(MDTestInput[i]), buffer);
206 printf("MD5 (\"%s\") = %s", MDTestInput[i], buffer);
207 if (strcmp(buffer, MDTestOutput[i]) == 0)
208 printf(" - verified correct\n");
209 else
210 printf(" - INCORRECT RESULT!\n");
211 }
188}
189
190/*
191 * Digests the standard input and prints the result.
192 */
193static void
194MDFilter(int tee)
195{

--- 21 unchanged lines hidden ---
212}
213
214/*
215 * Digests the standard input and prints the result.
216 */
217static void
218MDFilter(int tee)
219{

--- 21 unchanged lines hidden ---