From shalunov@tuzik.lz.att.com Mon Mar 15 13:07:20 1999
Return-Path: <shalunov@tuzik.lz.att.com>
Received: from alms1.fw.att.com (alms1.att.com [192.128.167.146])
	by hub.freebsd.org (Postfix) with ESMTP id A784B150B6
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Mar 1999 13:07:09 -0800 (PST)
	(envelope-from shalunov@tuzik.lz.att.com)
Received: from tuzik.lz.att.com ([135.25.200.84])
	by alms1.fw.att.com (AT&T/IPNS/GW-1.0) with ESMTP id QAA14984
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Mar 1999 16:06:50 -0500 (EST)
Received: (from root@localhost)
	by tuzik.lz.att.com (8.9.2/8.9.2) id PAA21615;
	Mon, 15 Mar 1999 15:08:22 -0500 (EST)
	(envelope-from shalunov)
Message-Id: <199903152008.PAA21615@tuzik.lz.att.com>
Date: Mon, 15 Mar 1999 15:08:22 -0500 (EST)
From: shalunov@lynxhub.lz.att.com
Sender: shalunov@tuzik.lz.att.com
Reply-To: shalunov@lynxhub.lz.att.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] `md5 -t' too fast on modern CPUs
X-Send-Pr-Version: 3.2

>Number:         10604
>Category:       bin
>Synopsis:       [PATCH] `md5 -t' too fast on modern CPUs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 15 13:10:00 PST 1999
>Closed-Date:    Sat May 1 07:54:36 PDT 1999
>Last-Modified:  Sat May  1 07:55:15 PDT 1999
>Originator:     stanislav shalunov
>Release:        FreeBSD 3.1-RELEASE i386
>Organization:
AT&T
>Environment:

FreeBSD tuzik.lz.att.com 3.1-RELEASE FreeBSD 3.1-RELEASE #0: Wed Mar 10 11:57:33 EST 1999     shalunov@tuzik.lz.att.com:/usr/src/sys/compile/TUZIK  i386

>Description:

	I am reporting two problems in one report, in fact.

	First, `md5 -t' by default digests 1000 1000-byte blocks
	and measures time in whole seconds.  On any modern CPU
	this operation certainly takes much less than 1 second,
	thus rendering the option useless.  I changed it in such
	a way that on my PII 350 it takes about 13-14 seconds.

	Second, the message ``Digesting...'' was not flushed, which
	made it useless, too (there is no newline in the end of
	message).

>How-To-Repeat:

	$ md5 -t

>Fix:
	
	Quick fix below:

--- md5.c~	Mon Mar 15 14:55:52 1999
+++ md5.c	Mon Mar 15 14:56:23 1999
@@ -34,8 +34,8 @@
 /*
  * Length of test block, number of test blocks.
  */
-#define TEST_BLOCK_LEN 1000
-#define TEST_BLOCK_COUNT 1000
+#define TEST_BLOCK_LEN 10000
+#define TEST_BLOCK_COUNT 50000
 
 static void MDString PROTO_LIST((char *));
 static void MDTimeTrial PROTO_LIST((void));
@@ -120,6 +120,7 @@
 	printf
 	    ("MD5 time trial. Digesting %d %d-byte blocks ...",
 	    TEST_BLOCK_COUNT, TEST_BLOCK_LEN);
+	fflush(stdout);
 
 	/* Initialize block */
 	for (i = 0; i < TEST_BLOCK_LEN; i++)


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Sat May 1 07:54:36 PDT 1999 
State-Changed-Why:  
Patch committed, thanks! 
>Unformatted:
