From: mccurley@cs.sandia.gov (Kevin S. McCurley)
Newsgroups: sci.crypt
Subject: Re: SHS/SHA source code + random thoughts
Keywords: SHS SHA message digest
Date: 5 Sep 92 15:18:37 GMT
Article-I.D.: cs.1992Sep5.151837.14322
Organization: Sandia National Laboratories, Albuquerque, NM

In article <1992Sep4.060230.28313@cs.aukuni.ac.nz> Peter Gutmann (pgut1@cs.aukuni.ac.nz) writes:
>SHA Speed
>=========
>
>  I ran the SHA code against the distributed version of MD5 (which is
>significantly less optimised than the SHA code).  The results were as follows:
>
>	      25 MHz PClone     DECstation 2100     DECstation 5000
>
>    SHA         31 K/sec           120 K/sec           208 K/sec
>    MD5         55 K/sec           169 K/sec           278 K/sec
>
>This comparison isn't 100% fair since the standard MD5 distribution is a
>somewhat pessimal implementation (in fact an optimised PC version runs around 5
>times faster).  An implementation of MD5 optimised to the level of SHA runs
>around 2 times faster.

I too have written a version of SHA in C.  I have now tested it on
numerous machines, but have not really optimized it for any (that
would require assembly language - yuck).  My personal animosity for
MS-DOG also prevented me from working hard on the PC version.  The
biggest improvements from a C version are probably possible for
little-endian machines like 80x86 machines.

Here are the results (all speeds are for hashing stuff from memory -
the time to read a file slows them down by about 10%): If you think
the choice of machines is bizarre - it's what I could find handy at
the time.  I omitted the really rare machines!

machine                                  bytes/second
---------------------------------------------------------
IBM RS/6000 530H, xlc -O                   1,098,000 
SGI IRIS (33 MHz Model 4D340), cc -O3      1,038,200
Sun Sparcstation 2, cc -O4                 1,009,000
IBM RS/6000 530, xlc -O -Q                   832,600
SGI IRIS (25 MHz Model 4D240), cc -O3        806,000
DECstation 5000, cc -O4                      598,000
Sun Sparcstation 1+, cc -O3                  507,000
Sun Sparcstation 1, cc -O4                   498,000
DECstation 3100, gcc -O2                     495,000
NeXTstation cc -O                            347,000
Gateway 2000 (50MHz 80486Dx2), gcc -O2       244,710
Sequent Symmetry (Intel 386), cc -O4          87,128
Zenith 386 (16MHz), gcc -O2                   81,761
Gateway 2000, Turbo C 2.0                     57,569
Zenith 386, Turbo C 2.0.                      17,700

The only direct comparision I see to Peter's figures are for the
Decstation 5000, where my results are about a factor of 2.8 faster.
This comparison may not be fair, since I don't know how Peter could
find a better compiler for his, or maybe he is reading stuff from a
file.

The only comparision I made to MD5 is using the code distributed by
anonymous FTP from rsa.com, which ran about 15% faster than my SHA
code on a Sparcstation 2.

As for judging the cryptographic strength of the two, only time will
tell.  In the meantime, unless disaster strikes, SHA is likely to
become SHS.

Kevin McCurley
Sandia National Laboratories
Newsgroups: sci.crypt,alt.security