What is the perl equivalent for this php code?
$hash = hash_hmac('sha256', $all , $secret);
I tried using the below code 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
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 it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With