Subject: | Digest::SHA's hmac_sha256_base64 is wrong |
Date: | Wed, 6 Jul 2016 13:43:41 +0100 |
To: | bug-Digest-SHA [...] rt.cpan.org |
From: | James Stanley <james [...] incoherency.co.uk> |
hmac_sha256_base64 is missing a trailing equals sign.
Example program:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Base64 qw(encode_base64);
use Digest::SHA qw(hmac_sha256 hmac_sha256_base64);
my $key = 'foo';
my $data = 'hello world';
print "hmac_sha256_base64: " . hmac_sha256_base64($data, $key) . "\n";
print "encode_base64(hmac_sha256): " . encode_base64(hmac_sha256($data,
$key)) . "\n";
Output:
hmac_sha256_base64: jvVS287gOBboArZDFbSGoJkwJBVkIGt4nprJe1BOzoo
encode_base64(hmac_sha256): jvVS287gOBboArZDFbSGoJkwJBVkIGt4nprJe1BOzoo=
I haven't yet tried to track down the source of the problem.
James