Subject: Re: muhah
To: Alistair Crooks <>
From: Trevor Johnson <>
List: tech-pkg
Date: 03/23/2001 12:17:07
> > You're right, the copy that comes with NetBSD 1.5 for i386 (base.tgz) is
> > 231292 bytes.  Still, pkgsrc itself is much larger than that.

> (and that includes CVS dirs, but excludes Makefile.openssl).  You're
> seriously telling me I should add well over 10 Megabytes of source to
> a single package in pkgsrc? OK, so on to executable sizes, which isn't
> really relevant:

I understand that OpenSSL, whether as source or binary, is much bigger
than your digest utility. So are other things--sh, make, tar and pax, awk,
patch, cc, and so on--which are needed for the use of pkgsrc.  If, for
example, the user hasn't installed a C compiler (not part of the base
system on NetBSD, Solaris, or most Linux distributions), pkgsrc doesn't
bootstrap one into place.  If the user installs the wrong C compiler--a
buggy, old, or trojaned one (food for thought: loses.

> > > 2.  openssl produces output in a slightly different format from
> > > md5(1).  I really don't want to have to pre-process everything with
> > > sed or awk or expr.
> >
> > Can't the existing md5 utility still handle the MD5 hashes which were
> > generated with it?  For the SHA-1 and RIPEMD-160 hashes, would you
> > consider making the output of your digest utility have the same format as
> > the output from OpenSSL?
> It's not a huge problem, it's a minor niggle. Yes, we can massage output
> with sed, awk or expr. But I don't want to do that.

You misunderstand.  What I requested is output from "digest sha1 foo" in
the format that "openssl dgst -sha1 foo" has, and likewise for "digest
rmd160 foo" to have the same format as "openssl dgst -rmd160".  That way,
if it ever becomes desirable to use OpenSSL for hashing--for instance, in
a future world where pre-1999 versions of NetBSD needn't to be fully
supported--such massaging will not be necessary.  I've appended a trivial
patch which does this.  For the SHA-1 and RIPEMD-160 hashes, the slightly
different output is unnecessary.  MD5 hashes have already been calculated,
so I don't propose changing them.

> > > 3.  I want a message digest calculation utility that is small and
> > > quick, and something that either is present on all Operating Systems
> > > on which pkgsrc runs, or is buildable on those operating systems with
> > > minimum fuss. openssl does not really fit the bill here.

> In the whole scheme of things, though, with all the other processing
> that is taking place at that time, the speed of the code produced by
> an optimising compiler vs.  hand-tuned assembly code is fairly low on
> my list of priorities.

Thanks for dropping the objection.
Trevor Johnson

--- digest.c.orig	Fri Mar  9 13:24:49 2001
+++ digest.c	Fri Mar 23 08:04:20 2001
@@ -95,7 +95,7 @@
 		if (SHA1File(fn, digest) == NULL) {
 			return 0;
-		(void) printf("SHA1 (%s) = %s\n", fn, digest);
+		(void) printf("SHA1(%s)= %s\n", fn, digest);
 	return 1;
@@ -119,7 +119,7 @@
 		if (RMD160File(fn, digest) == NULL) {
 			return 0;
-		(void) printf("RMD160 (%s) = %s\n", fn, digest);
+		(void) printf("RIPEMD160(%s)= %s\n", fn, digest);
 	return 1;