SHA-based encryption function in Python

Gerhard Häring gerhard at bigfoot.de
Thu Apr 25 00:20:58 EDT 2002


* Paul Rubin <phr-n2002a at nightsong.com> [2002-04-24 20:05 -0700]:
> 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.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))





More information about the Python-list mailing list