summaryrefslogtreecommitdiff
path: root/bin/md5
diff options
context:
space:
mode:
Diffstat (limited to 'bin/md5')
-rw-r--r--bin/md5/cksum.16
-rw-r--r--bin/md5/md5.16
-rw-r--r--bin/md5/md5.c21
-rw-r--r--bin/md5/rmd160.16
-rw-r--r--bin/md5/sha1.16
5 files changed, 32 insertions, 13 deletions
diff --git a/bin/md5/cksum.1 b/bin/md5/cksum.1
index 4bcdcb04626..5b5a50abeb4 100644
--- a/bin/md5/cksum.1
+++ b/bin/md5/cksum.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cksum.1,v 1.14 2007/03/27 13:12:41 millert Exp $
+.\" $OpenBSD: cksum.1,v 1.15 2007/04/13 13:57:01 tedu Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -175,6 +175,10 @@ Prints a checksum of the given
.Ar string .
.It Fl t
Runs a built-in time trial.
+Specifying
+.Fl t
+multiple times results in the number of rounds being multiplied
+by 10 for each additional flag.
.It Fl x
Runs a built-in test script.
.El
diff --git a/bin/md5/md5.1 b/bin/md5/md5.1
index 24c5400840a..27af7a56180 100644
--- a/bin/md5/md5.1
+++ b/bin/md5/md5.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: md5.1,v 1.26 2007/03/27 20:40:04 millert Exp $
+.\" $OpenBSD: md5.1,v 1.27 2007/04/13 13:57:01 tedu Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@@ -82,6 +82,10 @@ Prints a checksum of the given
.Ar string .
.It Fl t
Runs a built-in time trial.
+Specifying
+.Fl t
+multiple times results in the number of rounds being multiplied
+by 10 for each additional flag.
.It Fl x
Runs a built-in test script.
.El
diff --git a/bin/md5/md5.c b/bin/md5/md5.c
index cf3f2e47655..73fdec73d53 100644
--- a/bin/md5/md5.c
+++ b/bin/md5/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.44 2007/03/29 15:20:51 millert Exp $ */
+/* $OpenBSD: md5.c,v 1.45 2007/04/13 13:57:01 tedu Exp $ */
/*
* Copyright (c) 2001,2003,2005-2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -190,7 +190,7 @@ void digest_print(const struct hash_function *, const char *, const char *);
void digest_printstr(const struct hash_function *, const char *, const char *);
void digest_string(char *, struct hash_list *);
void digest_test(struct hash_list *);
-void digest_time(struct hash_list *);
+void digest_time(struct hash_list *, int);
void hash_insert(struct hash_list *, struct hash_function *, int);
void usage(void) __attribute__((__noreturn__));
@@ -298,7 +298,7 @@ main(int argc, char **argv)
input_string = optarg;
break;
case 't':
- tflag = 1;
+ tflag++;
break;
case 'x':
xflag = 1;
@@ -311,7 +311,7 @@ main(int argc, char **argv)
argv += optind;
/* Most arguments are mutually exclusive */
- fl = pflag + tflag + xflag + cflag + (input_string != NULL);
+ fl = pflag + (tflag ? 1 : 0) + xflag + cflag + (input_string != NULL);
if (fl > 1 || (fl && argc && cflag == 0) || (rflag && qflag))
usage();
if (cflag != 0) {
@@ -339,7 +339,7 @@ main(int argc, char **argv)
}
if (tflag)
- digest_time(&hl);
+ digest_time(&hl, tflag);
else if (xflag)
digest_test(&hl);
else if (input_string)
@@ -668,7 +668,7 @@ digest_filelist(const char *file, struct hash_function *defhash)
#define TEST_BLOCK_COUNT 10000
void
-digest_time(struct hash_list *hl)
+digest_time(struct hash_list *hl, int times)
{
struct hash_function *hf;
struct timeval start, stop, res;
@@ -677,10 +677,13 @@ digest_time(struct hash_list *hl)
u_char data[TEST_BLOCK_LEN];
char digest[MAX_DIGEST_LEN + 1];
double elapsed;
+ int count = TEST_BLOCK_COUNT;
+ while (--times > 0)
+ count *= 10;
TAILQ_FOREACH(hf, hl, tailq) {
(void)printf("%s time trial. Processing %d %d-byte blocks...",
- hf->name, TEST_BLOCK_COUNT, TEST_BLOCK_LEN);
+ hf->name, count, TEST_BLOCK_LEN);
fflush(stdout);
/* Initialize data based on block number. */
@@ -689,7 +692,7 @@ digest_time(struct hash_list *hl)
gettimeofday(&start, NULL);
hf->init(&context);
- for (i = 0; i < TEST_BLOCK_COUNT; i++)
+ for (i = 0; i < count; i++)
hf->update(&context, data, TEST_BLOCK_LEN);
digest_end(hf, &context, digest, sizeof(digest), hf->base64);
gettimeofday(&stop, NULL);
@@ -699,7 +702,7 @@ digest_time(struct hash_list *hl)
(void)printf("\nDigest = %s\n", digest);
(void)printf("Time = %f seconds\n", elapsed);
(void)printf("Speed = %f bytes/second\n",
- TEST_BLOCK_LEN * TEST_BLOCK_COUNT / elapsed);
+ (double)TEST_BLOCK_LEN * count / elapsed);
}
}
diff --git a/bin/md5/rmd160.1 b/bin/md5/rmd160.1
index b80d8e25146..815fe8e677f 100644
--- a/bin/md5/rmd160.1
+++ b/bin/md5/rmd160.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rmd160.1,v 1.22 2007/03/27 20:40:04 millert Exp $
+.\" $OpenBSD: rmd160.1,v 1.23 2007/04/13 13:57:01 tedu Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@@ -77,6 +77,10 @@ Prints a checksum of the given
.Ar string .
.It Fl t
Runs a built-in time trial.
+Specifying
+.Fl t
+multiple times results in the number of rounds being multiplied
+by 10 for each additional flag.
.It Fl x
Runs a built-in test script.
.El
diff --git a/bin/md5/sha1.1 b/bin/md5/sha1.1
index 0d406ff1a48..23c37f6c6e7 100644
--- a/bin/md5/sha1.1
+++ b/bin/md5/sha1.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sha1.1,v 1.24 2007/03/27 20:40:04 millert Exp $
+.\" $OpenBSD: sha1.1,v 1.25 2007/04/13 13:57:01 tedu Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@@ -77,6 +77,10 @@ Prints a checksum of the given
.Ar string .
.It Fl t
Runs a built-in time trial.
+Specifying
+.Fl t
+multiple times results in the number of rounds being multiplied
+by 10 for each additional flag.
.It Fl x
Runs a built-in test script.
.El