Skip Menu |

This queue is for tickets about the Digest-SHA CPAN distribution.

Report information
The Basics
Id: 115918
Status: rejected
Worked: 5 min
Priority: 0/
Queue: Digest-SHA

People
Owner: Nobody in particular
Requestors: james [...] incoherency.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Subject: Re: [rt.cpan.org #115918] AutoReply: Digest::SHA's hmac_sha256_base64 is wrong
Date: Wed, 6 Jul 2016 14:02:44 +0100
To: bug-Digest-SHA [...] rt.cpan.org
From: James Stanley <james [...] incoherency.co.uk>
It seems this behaviour is intended, and is in fact documented in the POD if you know what to look for. James On 06/07/16 13:43, Bugs in Digest-SHA via RT wrote: Show quoted text
> Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Digest::SHA's hmac_sha256_base64 is wrong", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #115918]. Your ticket is accessible > on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=115918 > > Please include the string: > > [rt.cpan.org #115918] > > in the subject line of all future correspondence about this issue. To do so, > you may reply to this message. > > Thank you, > bug-Digest-SHA@rt.cpan.org > > ------------------------------------------------------------------------- > 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
Base64 digests are NOT padded in CPAN Digest modules. Reference http://search.cpan.org/dist/Digest-SHA/lib/Digest/SHA.pm#PADDING_OF_BASE64_DIGESTS for details. Mark