summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2017-12-18 13:15:34 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2017-12-18 13:15:34 +0000
commit99324e305b608b891d48b7a583cd9bb16a4d0a7c (patch)
treea049022b9b9e11c1606f5227a99acfbdebece4b5
parent5a736967cf2e79570d400232dbe0c1915cc64d07 (diff)
downloadperl-99324e305b608b891d48b7a583cd9bb16a4d0a7c.tar.gz
Update Digest-SHA to CPAN version 6.00
[DELTA] 6.00 Fri Dec 8 22:44:44 MST 2017 - added "tag" option (BSD-style checksums) to shasum -- consistent with GNU sha1sum, sha224sum, etc. -- thanks to Christopher Tubbs for suggestion - modified SHA.pm to use XSLoader -- falls back to DynaLoader if necessary - decoupled Digest::SHA and Digest::SHA::PurePerl -- scripts/tests in each module now fully independent -- Digest::SHA::PurePerl to be phased out eventually -- past versions will remain available
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--cpan/Digest-SHA/SHA.xs2
-rw-r--r--cpan/Digest-SHA/lib/Digest/SHA.pm17
-rw-r--r--cpan/Digest-SHA/shasum48
-rw-r--r--cpan/Digest-SHA/src/sha.c4
-rw-r--r--cpan/Digest-SHA/src/sha.h4
-rw-r--r--cpan/Digest-SHA/src/sha64bit.c4
-rw-r--r--cpan/Digest-SHA/src/sha64bit.h4
-rw-r--r--cpan/Digest-SHA/t/allfcns.t33
-rw-r--r--cpan/Digest-SHA/t/base64.t15
-rw-r--r--cpan/Digest-SHA/t/bitbuf.t19
-rw-r--r--cpan/Digest-SHA/t/bitorder.t34
-rw-r--r--cpan/Digest-SHA/t/fips180-4.t14
-rw-r--r--cpan/Digest-SHA/t/fips198.t13
-rw-r--r--cpan/Digest-SHA/t/gg.t19
-rw-r--r--cpan/Digest-SHA/t/gglong.t21
-rw-r--r--cpan/Digest-SHA/t/hmacsha.t17
-rw-r--r--cpan/Digest-SHA/t/inheritance.t19
-rw-r--r--cpan/Digest-SHA/t/ireland.t15
-rw-r--r--cpan/Digest-SHA/t/methods.t21
-rw-r--r--cpan/Digest-SHA/t/nistbit.t19
-rw-r--r--cpan/Digest-SHA/t/nistbyte.t19
-rw-r--r--cpan/Digest-SHA/t/rfc2202.t13
-rw-r--r--cpan/Digest-SHA/t/sha1.t14
-rw-r--r--cpan/Digest-SHA/t/sha224.t14
-rw-r--r--cpan/Digest-SHA/t/sha256.t14
-rw-r--r--cpan/Digest-SHA/t/sha384.t14
-rw-r--r--cpan/Digest-SHA/t/sha512.t14
-rw-r--r--cpan/Digest-SHA/t/state.t15
-rw-r--r--cpan/Digest-SHA/t/unicode.t13
-rw-r--r--cpan/Digest-SHA/t/woodbury.t21
31 files changed, 179 insertions, 316 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index b662ea8788..bc26d5071f 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -377,7 +377,7 @@ use File::Glob qw(:case);
},
'Digest::SHA' => {
- 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.98.tar.gz',
+ 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-6.00.tar.gz',
'FILES' => q[cpan/Digest-SHA],
'EXCLUDED' => [
qw( t/pod.t
diff --git a/cpan/Digest-SHA/SHA.xs b/cpan/Digest-SHA/SHA.xs
index 0a0c89d4e3..62eaad8d53 100644
--- a/cpan/Digest-SHA/SHA.xs
+++ b/cpan/Digest-SHA/SHA.xs
@@ -401,6 +401,6 @@ PPCODE:
}
if (cr) {
in[0] = '\012';
- shawrite(in, 1 << 3, state);
+ shawrite(in, 1UL << 3, state);
}
XSRETURN(1);
diff --git a/cpan/Digest-SHA/lib/Digest/SHA.pm b/cpan/Digest-SHA/lib/Digest/SHA.pm
index 6a60926067..53b3f06f5d 100644
--- a/cpan/Digest-SHA/lib/Digest/SHA.pm
+++ b/cpan/Digest-SHA/lib/Digest/SHA.pm
@@ -8,11 +8,10 @@ use vars qw($VERSION @ISA @EXPORT_OK);
use Fcntl qw(O_RDONLY);
use integer;
-$VERSION = '5.98';
+$VERSION = '6.00';
require Exporter;
-require DynaLoader;
-@ISA = qw(Exporter DynaLoader);
+@ISA = qw(Exporter);
@EXPORT_OK = qw(
hmac_sha1 hmac_sha1_base64 hmac_sha1_hex
hmac_sha224 hmac_sha224_base64 hmac_sha224_hex
@@ -124,7 +123,7 @@ sub addfile {
if ($BITS) {
my ($n, $buf) = (0, "");
while (($n = read(FH, $buf, 4096))) {
- $buf =~ s/[^01]//g;
+ $buf =~ tr/01//cd;
$self->add_bits($buf);
}
_bail("Read failed") unless defined $n;
@@ -236,7 +235,15 @@ sub load {
$class->putstate($str);
}
-Digest::SHA->bootstrap($VERSION);
+eval {
+ require XSLoader;
+ XSLoader::load('Digest::SHA', $VERSION);
+ 1;
+} or do {
+ require DynaLoader;
+ push @ISA, 'DynaLoader';
+ Digest::SHA->bootstrap($VERSION);
+};
1;
__END__
diff --git a/cpan/Digest-SHA/shasum b/cpan/Digest-SHA/shasum
index 1b9bf6e6f9..25330ddd94 100644
--- a/cpan/Digest-SHA/shasum
+++ b/cpan/Digest-SHA/shasum
@@ -4,8 +4,8 @@
##
## Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved
##
- ## Version: 5.98
- ## Wed Oct 4 00:40:02 MST 2017
+ ## Version: 6.00
+ ## Fri Dec 8 22:44:44 MST 2017
## shasum SYNOPSIS adapted from GNU Coreutils sha1sum. Add
## "-a" option for algorithm selection,
@@ -35,6 +35,7 @@ shasum - Print or Check SHA Checksums
-a, --algorithm 1 (default), 224, 256, 384, 512, 512224, 512256
-b, --binary read in binary mode
-c, --check read SHA sums from the FILEs and check them
+ --tag create a BSD-style checksum
-t, --text read in text mode (default)
-U, --UNIVERSAL read in Universal Newlines mode
produces same digest on Windows/Unix/Mac
@@ -104,7 +105,7 @@ I<shasum> is implemented using the Perl module L<Digest::SHA>.
END_OF_POD
-my $VERSION = "5.98";
+my $VERSION = "6.00";
sub usage {
my($err, $msg) = @_;
@@ -132,7 +133,7 @@ select((select(STDERR), $| = 1)[0]);
## Collect options from command line
my ($alg, $binary, $check, $text, $status, $quiet, $warn, $help);
-my ($version, $BITS, $UNIVERSAL);
+my ($version, $BITS, $UNIVERSAL, $tag);
eval { Getopt::Long::Configure ("bundling") };
GetOptions(
@@ -143,6 +144,7 @@ GetOptions(
'h|help' => \$help, 'v|version' => \$version,
'0|01' => \$BITS,
'U|UNIVERSAL' => \$UNIVERSAL,
+ 'tag' => \$tag,
) or usage(1, "");
@@ -159,13 +161,23 @@ usage(1, "shasum: --status option used only when verifying checksums\n")
if $status && !$check;
usage(1, "shasum: --quiet option used only when verifying checksums\n")
if $quiet && !$check;
+usage(1, "shasum: --tag does not support --text mode\n")
+ if $tag && $text;
+usage(1, "shasum: --tag does not support Universal Newlines mode\n")
+ if $tag && $UNIVERSAL;
+usage(1, "shasum: --tag does not support BITS mode\n")
+ if $tag && $BITS;
## Default to SHA-1 unless overridden by command line option
+my %isAlg = map { $_ => 1 } (1, 224, 256, 384, 512, 512224, 512256);
$alg = 1 unless defined $alg;
-grep { $_ == $alg } (1, 224, 256, 384, 512, 512224, 512256)
- or usage(1, "shasum: Unrecognized algorithm\n");
+usage(1, "shasum: Unrecognized algorithm\n") unless $isAlg{$alg};
+
+my %Tag = map { $_ => "SHA$_" } (1, 224, 256, 384, 512);
+$Tag{512224} = "SHA512/224";
+$Tag{512256} = "SHA512/256";
## Display version information if requested
@@ -237,13 +249,21 @@ sub verify {
or die "shasum: $checkfile: $!\n";
while (<FH>) {
next if /^#/; $num_lines++;
- ($bslash, $sum, $modesym, $fname) =
+ if (/^[ \t]*\\?SHA/) {
+ $modesym = '*';
+ ($bslash, $alg, $fname, $sum) =
+ /^[ \t]*(\\?)SHA(\S+) \((.+)\) = ([\da-fA-F]+)/;
+ $alg =~ tr{/}{}d if defined $alg;
+ }
+ else {
+ ($bslash, $sum, $modesym, $fname) =
/^[ \t]*(\\?)([\da-fA-F]+)[ \t]([ *^U])(.+)/;
- $alg = defined $sum ? $len2alg{length($sum)} : undef;
- if (grep { ! defined $_ } ($alg, $sum, $modesym, $fname)) {
- $alg = 1 unless defined $alg;
+ $alg = defined $sum ? $len2alg{length($sum)} : undef;
+ }
+ if (grep { ! defined $_ } ($alg, $sum, $modesym, $fname) or
+ ! $isAlg{$alg}) {
warn("shasum: $checkfile: $.: improperly " .
- "formatted SHA$alg checksum line\n") if $warn;
+ "formatted SHA checksum line\n") if $warn;
$fmt_errs++;
next;
}
@@ -284,16 +304,16 @@ sub verify {
## Verify or compute SHA checksums of requested files
my($file, $digest);
-
my $STATUS = 0;
for $file (@ARGV) {
if ($check) { $STATUS = 1 unless verify($file) }
elsif ($digest = sumfile($file)) {
if ($file =~ /[\n\\]/) {
$file =~ s/\\/\\\\/g; $file =~ s/\n/\\n/g;
- $digest = "\\$digest";
+ print "\\";
}
- print "$digest $modesym", "$file\n";
+ unless ($tag) { print "$digest $modesym$file\n" }
+ else { print "$Tag{$alg} ($file) = $digest\n" }
}
else { $STATUS = 1 }
}
diff --git a/cpan/Digest-SHA/src/sha.c b/cpan/Digest-SHA/src/sha.c
index c1f7407fb4..ee1b4d82c6 100644
--- a/cpan/Digest-SHA/src/sha.c
+++ b/cpan/Digest-SHA/src/sha.c
@@ -5,8 +5,8 @@
*
* Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved
*
- * Version: 5.98
- * Wed Oct 4 00:40:02 MST 2017
+ * Version: 6.00
+ * Fri Dec 8 22:44:44 MST 2017
*
*/
diff --git a/cpan/Digest-SHA/src/sha.h b/cpan/Digest-SHA/src/sha.h
index afb6af5024..3347e9192c 100644
--- a/cpan/Digest-SHA/src/sha.h
+++ b/cpan/Digest-SHA/src/sha.h
@@ -5,8 +5,8 @@
*
* Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved
*
- * Version: 5.98
- * Wed Oct 4 00:40:02 MST 2017
+ * Version: 6.00
+ * Fri Dec 8 22:44:44 MST 2017
*
*/
diff --git a/cpan/Digest-SHA/src/sha64bit.c b/cpan/Digest-SHA/src/sha64bit.c
index f9693d27d2..988a04ccf0 100644
--- a/cpan/Digest-SHA/src/sha64bit.c
+++ b/cpan/Digest-SHA/src/sha64bit.c
@@ -5,8 +5,8 @@
*
* Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved
*
- * Version: 5.98
- * Wed Oct 4 00:40:02 MST 2017
+ * Version: 6.00
+ * Fri Dec 8 22:44:44 MST 2017
*
*/
diff --git a/cpan/Digest-SHA/src/sha64bit.h b/cpan/Digest-SHA/src/sha64bit.h
index f6f89592f8..f57d03cf0d 100644
--- a/cpan/Digest-SHA/src/sha64bit.h
+++ b/cpan/Digest-SHA/src/sha64bit.h
@@ -5,8 +5,8 @@
*
* Copyright (C) 2003-2017 Mark Shelor, All Rights Reserved
*
- * Version: 5.98
- * Wed Oct 4 00:40:02 MST 2017
+ * Version: 6.00
+ * Fri Dec 8 22:44:44 MST 2017
*
* The following macros supply placeholder values that enable the
* sha.c module to successfully compile when 64-bit integer types
diff --git a/cpan/Digest-SHA/t/allfcns.t b/cpan/Digest-SHA/t/allfcns.t
index 9f2a9ba534..0d04e94310 100644
--- a/cpan/Digest-SHA/t/allfcns.t
+++ b/cpan/Digest-SHA/t/allfcns.t
@@ -1,23 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(
- hmac_sha1 hmac_sha1_base64 hmac_sha1_hex
- hmac_sha224 hmac_sha224_base64 hmac_sha224_hex
- hmac_sha256 hmac_sha256_base64 hmac_sha256_hex
- hmac_sha384 hmac_sha384_base64 hmac_sha384_hex
- hmac_sha512 hmac_sha512_base64 hmac_sha512_hex
- sha1 sha1_base64 sha1_hex
- sha224 sha224_base64 sha224_hex
- sha256 sha256_base64 sha256_hex
- sha384 sha384_base64 sha384_hex
- sha512 sha512_base64 sha512_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -25,6 +5,19 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(
+ hmac_sha1 hmac_sha1_base64 hmac_sha1_hex
+ hmac_sha224 hmac_sha224_base64 hmac_sha224_hex
+ hmac_sha256 hmac_sha256_base64 hmac_sha256_hex
+ hmac_sha384 hmac_sha384_base64 hmac_sha384_hex
+ hmac_sha512 hmac_sha512_base64 hmac_sha512_hex
+ sha1 sha1_base64 sha1_hex
+ sha224 sha224_base64 sha224_hex
+ sha256 sha256_base64 sha256_hex
+ sha384 sha384_base64 sha384_hex
+ sha512 sha512_base64 sha512_hex);
+
print "1..1\n";
print "ok 1\n";
diff --git a/cpan/Digest-SHA/t/base64.t b/cpan/Digest-SHA/t/base64.t
index 2cafdbd8de..284092d560 100644
--- a/cpan/Digest-SHA/t/base64.t
+++ b/cpan/Digest-SHA/t/base64.t
@@ -1,14 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha1_base64 sha224_base64 sha256_base64
- sha384_base64 sha512_base64));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -16,6 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha1_base64 sha224_base64 sha256_base64
+ sha384_base64 sha512_base64);
+
my $in = "abc";
my @out = map { eval } <DATA>;
my @fcn = (\&sha1_base64, \&sha224_base64, \&sha256_base64,
diff --git a/cpan/Digest-SHA/t/bitbuf.t b/cpan/Digest-SHA/t/bitbuf.t
index 78b499baba..a8b5472aba 100644
--- a/cpan/Digest-SHA/t/bitbuf.t
+++ b/cpan/Digest-SHA/t/bitbuf.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,6 +5,9 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA;
+
my $numtests = 4;
print "1..$numtests\n";
@@ -23,7 +16,7 @@ print "1..$numtests\n";
my $ONEBITS = pack("B*", "1" x 80000);
my $digest = "11003389959355c2773af6b0f36d842fe430ec49";
-my $state = $MODULE->new("sHa1");
+my $state = Digest::SHA->new("sHa1");
my $testnum = 1;
$state->add_bits($ONEBITS, 80000);
@@ -44,7 +37,7 @@ print "ok ", $testnum++, "\n";
# create a buffer-alignment nuisance
-$state = $MODULE->new("1");
+$state = Digest::SHA->new("1");
$state->add_bits($ONEBITS, 1);
for (1 .. 99) {
@@ -60,7 +53,7 @@ print "ok ", $testnum++, "\n";
my $reps = 80000;
my $maxbits = 8 * 127;
-$state = $MODULE->new(1);
+$state = Digest::SHA->new(1);
while ($reps > $maxbits) {
my $num = int(rand($maxbits));
diff --git a/cpan/Digest-SHA/t/bitorder.t b/cpan/Digest-SHA/t/bitorder.t
index 2cd2dbf56b..1419bb5dcb 100644
--- a/cpan/Digest-SHA/t/bitorder.t
+++ b/cpan/Digest-SHA/t/bitorder.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,15 +5,21 @@ BEGIN {
}
}
-my $s1 = $MODULE->new;
-my $s2 = $MODULE->new;
-my $d1 = $s1->add_bits("110")->hexdigest;
-my $d2 = $s2->add_bits("1")->add_bits("1")->add_bits("0")->hexdigest;
+use strict;
+use Digest::SHA;
-my $numtests = 1;
+my $numtests = 2;
print "1..$numtests\n";
-for (1 .. $numtests) {
- print "not " unless $d1 eq $d2;
- print "ok ", $_, "\n";
-}
+my $testnum = 1;
+my $s1 = Digest::SHA->new;
+my $s2 = Digest::SHA->new;
+my $d1 = $s1->add_bits("110")->hexdigest;
+my $d2 = $s2->add_bits("1")->add_bits("1")->add_bits("0")->hexdigest;
+print "not " unless $d1 eq $d2;
+print "ok ", $testnum++, "\n";
+
+$d1 = $s1->add_bits("111100001010")->hexdigest;
+$d2 = $s2->add_bits("\xF0\xA0", 12)->hexdigest;
+print "not " unless $d1 eq $d2;
+print "ok ", $testnum++, "\n";
diff --git a/cpan/Digest-SHA/t/fips180-4.t b/cpan/Digest-SHA/t/fips180-4.t
index 78feb8d6c8..15ad0177f9 100644
--- a/cpan/Digest-SHA/t/fips180-4.t
+++ b/cpan/Digest-SHA/t/fips180-4.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha512_hex sha512224_hex sha512256_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha512_hex sha512224_hex sha512256_hex);
+
my @vecs = map { eval } <DATA>;
-# $#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/fips198.t b/cpan/Digest-SHA/t/fips198.t
index f6f5007f5f..6d5a2e0bc1 100644
--- a/cpan/Digest-SHA/t/fips198.t
+++ b/cpan/Digest-SHA/t/fips198.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(hmac_sha1_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,6 +5,9 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(hmac_sha1_hex);
+
my @data = map { "Sample #$_" } (1 .. 4);
my @out = (
diff --git a/cpan/Digest-SHA/t/gg.t b/cpan/Digest-SHA/t/gg.t
index 6ca8f7fb9c..b78bb63dc9 100644
--- a/cpan/Digest-SHA/t/gg.t
+++ b/cpan/Digest-SHA/t/gg.t
@@ -1,15 +1,3 @@
-# Test against short bitwise vectors from Jim Gillogly and Francois Grieu
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,6 +5,11 @@ BEGIN {
}
}
+# Test against short bitwise vectors from Jim Gillogly and Francois Grieu
+
+use strict;
+use Digest::SHA;
+
# SHA-1 Test Vectors
#
# In the following we use the notation bitstring#n to mean a bitstring
@@ -57,7 +50,7 @@ my $numtests = scalar(@vecs) / 4;
print "1..$numtests\n";
my $testnum = 1;
-my $sha = $MODULE->new(1);
+my $sha = Digest::SHA->new(1);
while (@vecs) {
my $frag = shift @vecs;
diff --git a/cpan/Digest-SHA/t/gglong.t b/cpan/Digest-SHA/t/gglong.t
index 044799f69e..6daac47c71 100644
--- a/cpan/Digest-SHA/t/gglong.t
+++ b/cpan/Digest-SHA/t/gglong.t
@@ -1,15 +1,3 @@
-# Test against long bitwise vectors from Jim Gillogly and Francois Grieu
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,6 +5,11 @@ BEGIN {
}
}
+# Test against long bitwise vectors from Jim Gillogly and Francois Grieu
+
+use strict;
+use Digest::SHA;
+
# SHA-1 Test Vectors
#
# In the following we use the notation bitstring#n to mean a bitstring
@@ -57,7 +50,7 @@ for (1 .. 8) { my $line = <DATA>; $STATE011 .= $line }
my $testnum = 1;
print "1..", scalar(@vec110)/2 + scalar(@vec011)/2, "\n";
-my $state110 = $MODULE->putstate($STATE110);
+my $state110 = Digest::SHA->putstate($STATE110);
while (@vec110) {
my $state = $state110->clone;
$state->add_bits(shift @vec110);
@@ -65,7 +58,7 @@ while (@vec110) {
print "ok ", $testnum++, "\n";
}
-my $state011 = $MODULE->putstate($STATE011);
+my $state011 = Digest::SHA->putstate($STATE011);
while (@vec011) {
my $state = $state011->clone;
$state->add_bits(shift @vec011);
diff --git a/cpan/Digest-SHA/t/hmacsha.t b/cpan/Digest-SHA/t/hmacsha.t
index 47e65fefbe..b1e8e3441f 100644
--- a/cpan/Digest-SHA/t/hmacsha.t
+++ b/cpan/Digest-SHA/t/hmacsha.t
@@ -1,15 +1,3 @@
-# HMAC-SHA-256 test vectors from draft-ietf-ipsec-ciph-sha-256-01.txt
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(hmac_sha256 hmac_sha256_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,6 +5,11 @@ BEGIN {
}
}
+# HMAC-SHA-256 test vectors from draft-ietf-ipsec-ciph-sha-256-01.txt
+
+use strict;
+use Digest::SHA qw(hmac_sha256 hmac_sha256_hex);
+
my @data = map { eval } <DATA>;
my $numtests = scalar @data;
diff --git a/cpan/Digest-SHA/t/inheritance.t b/cpan/Digest-SHA/t/inheritance.t
index d94c23ae1a..27c43129d8 100644
--- a/cpan/Digest-SHA/t/inheritance.t
+++ b/cpan/Digest-SHA/t/inheritance.t
@@ -1,15 +1,3 @@
-# Adapted from script by Mark Lawrence (ref. rt.cpan.org #94830)
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha1));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,9 +5,14 @@ BEGIN {
}
}
+# Adapted from script by Mark Lawrence (ref. rt.cpan.org #94830)
+
+use strict;
+use Digest::SHA qw(sha1);
+
package P1;
use vars qw(@ISA);
-@ISA = ($MODULE);
+@ISA = ("Digest::SHA");
package main;
diff --git a/cpan/Digest-SHA/t/ireland.t b/cpan/Digest-SHA/t/ireland.t
index 46499950f4..edd650ac77 100644
--- a/cpan/Digest-SHA/t/ireland.t
+++ b/cpan/Digest-SHA/t/ireland.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -20,12 +10,15 @@ BEGIN {
# Adapted from Julius Duque's original script (t/24-ireland.tmp)
# - modified to use state cache via putstate method
+use strict;
+use Digest::SHA;
+
print "1..1\n";
my $rsp = "b9045a713caed5dff3d3b783e98d1ce5778d8bc331ee4119d707072312af06a7";
my $sha;
-if ($sha = $MODULE->putstate(join('', <DATA>))) {
+if ($sha = Digest::SHA->putstate(join('', <DATA>))) {
$sha->add("aa");
print "not " unless $sha->hexdigest eq $rsp;
print "ok 1\n";
diff --git a/cpan/Digest-SHA/t/methods.t b/cpan/Digest-SHA/t/methods.t
index a9096d926b..ef956b13c6 100644
--- a/cpan/Digest-SHA/t/methods.t
+++ b/cpan/Digest-SHA/t/methods.t
@@ -1,14 +1,3 @@
-use strict;
-use FileHandle;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -16,6 +5,10 @@ BEGIN {
}
}
+use strict;
+use FileHandle;
+use Digest::SHA;
+
my @out = (
"ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0",
"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
@@ -28,11 +21,11 @@ print "1..$numtests\n";
my $testnum = 1;
my $NSA = "SHA-42"; # No Such Algorithm
-print "not " if $MODULE->new($NSA);
+print "not " if Digest::SHA->new($NSA);
print "ok ", $testnum++, "\n";
my $tempfile = "methods.tmp";
-END { 1 while unlink $tempfile }
+END { unlink $tempfile if $tempfile }
# test OO methods using first two SHA-256 vectors from NIST
@@ -41,7 +34,7 @@ binmode($fh);
print $fh "bcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
$fh->close;
-my $sha = $MODULE->new()->reset("SHA-256")->new();
+my $sha = Digest::SHA->new()->reset("SHA-256")->new();
$sha->add_bits("a", 5)->add_bits("001");
my $rsp = shift(@out);
diff --git a/cpan/Digest-SHA/t/nistbit.t b/cpan/Digest-SHA/t/nistbit.t
index 91dc2804d9..b035ed4e59 100644
--- a/cpan/Digest-SHA/t/nistbit.t
+++ b/cpan/Digest-SHA/t/nistbit.t
@@ -1,15 +1,3 @@
-# Test against SHA-1 Sample Vectors from NIST
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,6 +5,11 @@ BEGIN {
}
}
+# Test against SHA-1 Sample Vectors from NIST
+
+use strict;
+use Digest::SHA;
+
my $nist_hashes = <<END_OF_NIST_HASHES;
DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 ^
59C4526AA2CC59F9A5F56B5579BA7108E7CCB61A ^
@@ -51,7 +44,7 @@ print "1..", scalar(@hashes), "\n";
my $testnum = 1;
my $message = "";
-my $sha = $MODULE->new(1);
+my $sha = Digest::SHA->new(1);
for (@lines) {
next unless /^[\d ^]/;
$message .= $_;
diff --git a/cpan/Digest-SHA/t/nistbyte.t b/cpan/Digest-SHA/t/nistbyte.t
index ce133d6467..722b920814 100644
--- a/cpan/Digest-SHA/t/nistbyte.t
+++ b/cpan/Digest-SHA/t/nistbyte.t
@@ -1,15 +1,3 @@
-# Test against SHA-1 Sample Vectors from NIST
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw());
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -17,6 +5,11 @@ BEGIN {
}
}
+# Test against SHA-1 Sample Vectors from NIST
+
+use strict;
+use Digest::SHA;
+
my $nist_hashes = <<END_OF_NIST_HASHES;
DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 ^
3CDF2936DA2FC556BFA533AB1EB59CE710AC80E5 ^
@@ -51,7 +44,7 @@ print "1..", scalar(@hashes), "\n";
my $testnum = 1;
my $message = "";
-my $sha = $MODULE->new(1);
+my $sha = Digest::SHA->new(1);
for (@lines) {
next unless /^[\d ^]/;
$message .= $_;
diff --git a/cpan/Digest-SHA/t/rfc2202.t b/cpan/Digest-SHA/t/rfc2202.t
index 3efb50b5a5..acdf8c037b 100644
--- a/cpan/Digest-SHA/t/rfc2202.t
+++ b/cpan/Digest-SHA/t/rfc2202.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(hmac_sha1_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,6 +5,9 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(hmac_sha1_hex);
+
my @data = map { eval } <DATA>;
my $numtests = scalar @data;
diff --git a/cpan/Digest-SHA/t/sha1.t b/cpan/Digest-SHA/t/sha1.t
index ed2c68edcf..c2ab2116fd 100644
--- a/cpan/Digest-SHA/t/sha1.t
+++ b/cpan/Digest-SHA/t/sha1.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha1_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha1_hex);
+
my @vecs = map { eval } <DATA>;
-$#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/sha224.t b/cpan/Digest-SHA/t/sha224.t
index e94820d485..f083bd3920 100644
--- a/cpan/Digest-SHA/t/sha224.t
+++ b/cpan/Digest-SHA/t/sha224.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha224_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha224_hex);
+
my @vecs = map { eval } <DATA>;
-$#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/sha256.t b/cpan/Digest-SHA/t/sha256.t
index 78aeb9dc3d..5bcee35862 100644
--- a/cpan/Digest-SHA/t/sha256.t
+++ b/cpan/Digest-SHA/t/sha256.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha256_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha256_hex);
+
my @vecs = map { eval } <DATA>;
-$#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/sha384.t b/cpan/Digest-SHA/t/sha384.t
index 9d026ae1ff..16fefcf07c 100644
--- a/cpan/Digest-SHA/t/sha384.t
+++ b/cpan/Digest-SHA/t/sha384.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha384_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha384_hex);
+
my @vecs = map { eval } <DATA>;
-$#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/sha512.t b/cpan/Digest-SHA/t/sha512.t
index fcfe766961..bf662db5a1 100644
--- a/cpan/Digest-SHA/t/sha512.t
+++ b/cpan/Digest-SHA/t/sha512.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha512_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,8 +5,10 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha512_hex);
+
my @vecs = map { eval } <DATA>;
-$#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
my $numtests = scalar(@vecs) / 2;
print "1..$numtests\n";
diff --git a/cpan/Digest-SHA/t/state.t b/cpan/Digest-SHA/t/state.t
index 83e2540818..c87e1f29db 100644
--- a/cpan/Digest-SHA/t/state.t
+++ b/cpan/Digest-SHA/t/state.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha384_hex sha512_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,6 +5,9 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha384_hex sha512_hex);
+
my @sharsp = (
"34aa973cd4c4daa4f61eeb2bdbad27316534016f",
"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0",
@@ -48,7 +41,7 @@ while (@sharsp) {
}
my $digest;
my $state;
- unless ($state = $MODULE->putstate(shift @states)) {
+ unless ($state = Digest::SHA->putstate(shift @states)) {
print "not ok ", $testnum++, "\n";
next;
}
diff --git a/cpan/Digest-SHA/t/unicode.t b/cpan/Digest-SHA/t/unicode.t
index 1e7bd13d53..4c87d83145 100644
--- a/cpan/Digest-SHA/t/unicode.t
+++ b/cpan/Digest-SHA/t/unicode.t
@@ -1,13 +1,3 @@
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(sha1_hex));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -15,6 +5,9 @@ BEGIN {
}
}
+use strict;
+use Digest::SHA qw(sha1_hex);
+
my $skip = $] < 5.006 ? 1 : 0;
my $TEMPLATE = $] >= 5.006 ? 'U*' : 'C*';
diff --git a/cpan/Digest-SHA/t/woodbury.t b/cpan/Digest-SHA/t/woodbury.t
index afcb731962..cdb49c7fd8 100644
--- a/cpan/Digest-SHA/t/woodbury.t
+++ b/cpan/Digest-SHA/t/woodbury.t
@@ -1,17 +1,3 @@
-# Test Vectors for HMAC-SHA-256/384/512
-#
-# Vectors and initial script courtesy of Adam Woodbury, The MITRE Corporation
-
-use strict;
-
-my $MODULE;
-
-BEGIN {
- $MODULE = (-d "src") ? "Digest::SHA" : "Digest::SHA::PurePerl";
- eval "require $MODULE" || die $@;
- $MODULE->import(qw(hmac_sha256 hmac_sha384 hmac_sha512));
-}
-
BEGIN {
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@@ -19,6 +5,13 @@ BEGIN {
}
}
+# Test Vectors for HMAC-SHA-256/384/512
+#
+# Vectors and initial script courtesy of Adam Woodbury, The MITRE Corporation
+
+use strict;
+use Digest::SHA qw(hmac_sha256 hmac_sha384 hmac_sha512);
+
my @plex = map { eval } <DATA>;
my $numtests = scalar(@plex) / 3;