Re: HMAC with RIPEMD-160

2008-12-22 Thread Kless
On 21 dic, 23:53, "Chris Rebert"  wrote:
> On Sun, Dec 21, 2008 at 4:21 AM, Kless  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
--
http://mail.python.org/mailman/listinfo/python-list


Re: HMAC with RIPEMD-160

2008-12-21 Thread Chris Rebert
On Sun, Dec 21, 2008 at 4:21 AM, Kless  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'))

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


HMAC with RIPEMD-160

2008-12-21 Thread Kless
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)
-


http://docs.python.org/library/hashlib.html
http://docs.python.org/library/hmac.html
--
http://mail.python.org/mailman/listinfo/python-list