SHA-based encryption function in Python

Paul Rubin phr-n2002a at nightsong.com
Thu Apr 25 07:45:40 EDT 2002


Gerhard =?iso-8859-15?Q?H=E4ring?= <gerhard at bigfoot.de> writes:
> > I'll experiment with some ways of coding HMAC to run fast in Python.
> > The implementation that comes with the 2.2 library is pretty slow.
> 
> Hmm, as the one who submitted this code, I don't see much room for
> improvement:
> 
> - the hexdigest method should really use binascii.hexlify(), but I
>   didn't know about the existence of it at the time
> 
> - I don't see how to optimize _strxor
> 
> But then, I never benchmarked the module.

_strxor should be a lot faster if it uses string.translate (or xor's
using the array module) rather than doing what it's doing.  I appended
my version to another message in this thread.



More information about the Python-list mailing list