[PYTHON-CRYPTO] high-performance HMAC module
Andrew Kuchling
akuchlin at mems-exchange.org
Thu May 30 20:49:00 CEST 2002
On Wed, May 29, 2002 at 02:54:43PM -0700, Bram Cohen wrote:
>By the way, the sha1 included in Python is very slow - around 2 megs/sec.
I can think of a few possible reasons for this. First is that the
main transformation is in the sha_transform() function in the C code,
so there's a C function call for every block of input text. This
might be difficult to fix, though, as sha_transform() is called from
several places and it's pretty long.
One silly thing that should be easily fixable is that sha_transform()
also does byte-swapping on every call, and it really shouldn't.
That's probably the low-hanging fruit here.
The R32() macro and the f()-functions could also be translated to
assembly code, but I haven't looked at the output of 'gcc -S' to see
what the generated code looks like.
--amk
More information about the python-crypto
mailing list