Skip Menu |

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

Report information
The Basics
Id: 53319
Status: resolved
Estimated: 15 min
Worked: 15 min
Priority: 0/
Queue: Digest-SHA

People
Owner: mshelor [...] cpan.org
Requestors: zefram [...] fysh.org
Cc:
AdminCc:

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



Subject: "shasum -a0" incorrectly accepted
Date: Sun, 3 Jan 2010 16:24:41 +0000
To: bug-Digest-SHA [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
$ echo foo | shasum -a0 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 - $ echo foo | shasum -a1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 - $ echo foo | shasum -a2 shasum: Unrecognized algorithm Type shasum -h for help $ "shasum -a0" is being interpreted as not requesting a specific algorithm, and so defaulting to SHA-1. This is not correct behaviour. SHA-0 is a distinct algorithm, defined in the original FIPS PUB 180 but later superseded by SHA-1 in FIPS PUB 180-1. Digest::SHA doesn't support SHA-0, and in the absence of such support shasum should generate the "Unrecognised algorithm" error when SHA-0 is requested. Attached patch fixes it. -zefram

Message body is not shown because sender requested not to inline it.

Indeed.  Thanks for the patch.

I'll publish the fix in a week or so, as part of the next release (5.48).

Mark

On Sun Jan 03 11:25:06 2010, zefram@fysh.org wrote:
Show quoted text
> $ echo foo | shasum -a0
> f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 -
> $ echo foo | shasum -a1
> f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 -
> $ echo foo | shasum -a2
> shasum: Unrecognized algorithm
> Type shasum -h for help
> $
>
> "shasum -a0" is being interpreted as not requesting a specific algorithm,
> and so defaulting to SHA-1. This is not correct behaviour. SHA-0 is
> a distinct algorithm, defined in the original FIPS PUB 180 but later
> superseded by SHA-1 in FIPS PUB 180-1. Digest::SHA doesn't support
> SHA-0, and in the absence of such support shasum should generate the
> "Unrecognised algorithm" error when SHA-0 is requested. Attached patch
> fixes it.
>
> -zefram