Jason R. Mastaler jason-list-python-crypto at MASTALER.COM
Fri May 31 00:38:11 CEST 2002

Paul Rubin <phr-pycrypt at NIGHTSONG.COM> writes:

> For long strings, the speed of HMAC will be limited by the speed of
> the SHA implementation.  For short strings, the hmac from p2.py
> should be quite a bit faster than the Python 2.2 hmac.py, but one in
> C will be even faster.

For clarification, what are the length of "short" and "long" strings
in this context?

> I don't mind if you adapt p2.py's HMAC implementation for your own
> module, but I'd appreciate a credit in your source file if you do
> that.

I thought I had done that, sorry.  It's done now.

> FWIW, I also have a replacement hmac.py (i.e. one that supplies the
> same OO interface as Python 2.2's HMAC module) that I'll put on my
> web site when I get back, if anyone wants it.

Yes, I'd like to take a look at it.

> I was thinking of submitting it to Guido since it should be somewhat
> faster than the original (though not as fast as a C function).

Why not just submit a C-based HMAC module instead?

> Finally, if your application needs a very fast MAC but doesn't have
> to be HMAC-SHA compatible, you might look at Dan Bernstein's hash127
> function

TMDA doesn't necessarily need HMAC-SHA, so hash127 would work, except
for that fact that I want to keep TMDA 100% Python, and don't want to
have to ship any C code.



More information about the python-crypto mailing list