Subject: | b64digest not working properly |
Hi,
I expected the following program to print two exact lines, but it doesn't, Digest::HMAC_SHA1 sometimes drops the trailing =.
Maybe my expectations are wrong :), but this caused some interoperability's issues with other services that use base64 encoded HMAC SHA1 signatures.
The workaround is of course, generate the binary digest and encode it with MIME::Base64 encode_base64.
#!/usr/bin/env perl
use v5.14;
use MIME::Base64;
use Digest::HMAC_SHA1;
my $hmac;
$hmac = Digest::HMAC_SHA1->new('hello');
$hmac->add('world');
say $hmac->b64digest;
$hmac = Digest::HMAC_SHA1->new('hello');
$hmac->add('world');
say encode_base64($hmac->digest, '');
Bye,