Hmac sha-256 in perl

What is the perl equivalent for this php code?

$hash = hash_hmac('sha256', $all , $secret);

I tried using the code below, but in vain. The values ​​are different.

  use Digest::SHA; $sha = Digest::SHA->new('sha256'); $sha->add($secret); $sha->add($all); $digest = $sha->hexdigest; 

Regards, Pavan

+7
source share
1 answer

Since my question was getting more views than I expected, I decided to answer it to help others with the same problem. I found the equivalent for it in PHP.

 use Digest::SHA qw(hmac_sha256_hex); $digest=hmac_sha256_hex($all, $secret); 

Hope this helps.

+11
source

All Articles