HMAC with RIPEMD-160

Kless jonas.esp at googlemail.com
Mon Dec 22 03:58:35 EST 2008


On 21 dic, 23:53, "Chris Rebert" <c... at rebertia.com> wrote:
> On Sun, Dec 21, 2008 at 4:21 AM, Kless <jonas.... at googlemail.com> wrote:
> > Is there any way of use HMAC with RIPEMD-160?
>
> > Since that to create a ripemd-160 hash there is to use:
> >    h = hashlib.new('ripemd160')
> > it looks that isn't possible
>
> > For HMAC-SHA256 would be:
> > ---------
> > import hashlib
> > import hmac
>
> > hm = hmac.new('key', msg='message', digestmod=hashlib.sha256)
>
> Untested, but should work according to the docs:
> hm = hmac.new('key', msg='message', digestmod=lambda: hashlib.new('ripemd160'))
>
It works, thank you



More information about the Python-list mailing list