cvs commit: src/lib/libmd Makefile sha256.3 sha256.h sha256c.c shadriver.c src/sbin/md5 Makefile md5.c

Colin Percival cperciva at freebsd.org
Wed Mar 9 12:00:07 PST 2005


Richard Coleman wrote:
> Is there a reason that there are multiple versions of
> md5/sha1/sha256/etc in the source tree?

As far as I could tell, we didn't have sha256 in the tree until I added
it.  As for md5 and sha1, it's useful to have a minimalist libmd for
applications which don't require the bloated monst^W^W^W OpenSSL, and
these are small enough that a bit of duplication really doesn't matter.

> It seems if these could be centralized, then it would be easier to have
> assembly accelerated versions for each platform, or better yet to
> utilize crypto hardware.

I'd be surprised if you could find crypto hardware which could accelerate
hashing -- the time it takes to send large amounts of data to a crypto
processor would probably exceed the time it takes to perform the hashing
on the host cpu.

Assembly optimization might be worthwhile; but for this sort of code, I
think you'd need to have a version optimized for each *processor* rather
than each *platform* in order to get any significant gain.  These hash
functions are designed for 32-bit processors in a manner which makes it
fairly hard for the compiler to get things wrong.

Colin Percival


More information about the cvs-all mailing list