[PYTHON-CRYPTO] Hashing modules

Ng Pheng Siong ngps at POST1.COM
Sun Feb 11 17:08:07 CET 2001


On Sun, Feb 11, 2001 at 11:37:18AM +0100, Michael Ströder wrote:
> So at least for a message digest function we almost agree on how it
> should be done. :-)

;-)

M2Crypto.EVP.HMAC presents the same interface, only difference being
that its __init__() accepts an additional parameter 'key':

>>> from M2Crypto.EVP import HMAC
>>> h1 = HMAC(key='key', 'sha1')
>>> h1.update('abc')
>>> h1.digest()
"O\320\262\025'n\361/+>L\216\312\302\201\024\230\266V\374"


M2Crypto.EVP.hmac() is a convenience function:

>>> from M2Crypto.EVP import hmac
>>> hmac('key', 'abc', 'sha1')
"O\320\262\025'n\361/+>L\216\312\302\201\024\230\266V\374"


--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps





More information about the python-crypto mailing list