Digest::HMAC

R

rihad

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.
 
R

rihad

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top