Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Digest::HMAC

0 views
Skip to first unread message

rihad

unread,
Nov 5, 2009, 10:26:20 AM11/5/09
to
Hi there, I need to convert this PHP code to Perl. How?

hash_hmac('sha1','Data to be hashed', 'some_secret_key');

I've looked into Digest::HMAC, but there's no way to specify sha1.
There's also Digest::SHA1, but I don't know how to mix the two
together.

Please help.

C.DeRykus

unread,
Nov 5, 2009, 11:51:14 AM11/5/09
to

rihad

unread,
Nov 5, 2009, 12:21:59 PM11/5/09
to
Hm, thanks. It's so strange I couldn't find it in FreeBSD ports.

rihad

unread,
Nov 5, 2009, 12:26:33 PM11/5/09
to
> Hm, thanks. It's so strange I couldn't find it in FreeBSD ports.
Oh, I see. This is how I'd do it:

use Digest::SHA1 qw(sha1);
use Digest::HMAC qw(hmac);

hmac('some_data', 'some_key', \&sha1, 64);

So Digest::HMAC_SHA1 simply show how to interconnect the two, just
what I needed.

0 new messages