[PYTHON-CRYPTO] SHA-1 benchmarks (was: HMAC module)
Zooko
zooko at zooko.com
Fri May 31 13:22:24 CEST 2002
These are all on the same machine just now. I'm not sure if they are
really comparable.
First I copied Bram's Python script to measure the `sha' module. I got a
vastly different result than he did:
MAIN imp:~$ python2.2
Python 2.2.1 (#1, May 3 2002, 23:19:03)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from time import time
>>> from sha import sha
>>> x = 'a' * 2 ** 20
>>> def test():
... t = time()
... for i in xrange(100):
... sha(x).digest()
... print 100.0/(time() - t)
...
>>> test()
18.208912899
>>>
(Bram got 1.3 as the result from the identical script.)
Then I ran `openssl speed sha':
MAIL imp:~/playground/mnet/extsrc/tst$ openssl speed sha
Doing sha1 for 3s on 8 size blocks: 902056 sha1's in 3.00s
Doing sha1 for 3s on 64 size blocks: 454294 sha1's in 3.00s
Doing sha1 for 3s on 256 size blocks: 195575 sha1's in 3.00s
Doing sha1 for 3s on 1024 size blocks: 59617 sha1's in 3.00s
Doing sha1 for 3s on 8192 size blocks: 7966 sha1's in 3.00s
OpenSSL 0.9.6c 21 dec 2001
built on: Sat Jan 5 19:53:45 CET 2002
options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) blowfish(idx)
compiler: gcc -fPIC -DTHREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DNO_IDEA -DNO_MDC2 -DNO_RC5 -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
The 'numbers' are in 1000s of bytes per second processed.
type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
sha1 2405.48k 9691.61k 16689.07k 20349.27k 21752.49k
Then I ran `cryptest.exe b' (from Crypto++ 4.2), and it reported
this:
Algorithm Bytes Processed Time Taken Megabytes(2^20 bytes)/Second
SHA-1 4194304 0.720 5.556
I doubt that these are comparable numbers. For one thing, Bram's machine and
mine are probably about the same speed, so him getting 1.3 and me getting 18.2
is pretty suspicious.
Regards,
Zooko
-------
Secure Distributed Systems Consulting -- http://zooko.com/
-------
More information about the python-crypto
mailing list