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.