cpan/Digest-SHA/t/base64.t See if Digest::SHA works
cpan/Digest-SHA/t/bitbuf.t See if Digest::SHA works
cpan/Digest-SHA/t/dumpload.t See if Digest::SHA works
+cpan/Digest-SHA/t/fips180-4.t See if Digest::SHA works
cpan/Digest-SHA/t/fips198.t See if Digest::SHA works
cpan/Digest-SHA/t/gglong.t See if Digest::SHA works
cpan/Digest-SHA/t/gg.t See if Digest::SHA works
'Digest::SHA' =>
{
'MAINTAINER' => 'mshelor',
- 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.50.tar.gz',
+ 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.60.tar.gz',
'FILES' => q[cpan/Digest-SHA],
'EXCLUDED' => [ qw{t/pod.t t/podcover.t examples/dups} ],
'UPSTREAM' => 'cpan',
Revision history for Perl extension Digest::SHA.
+5.60 Thu Mar 3 05:26:42 MST 2011
+ - added new SHA-512/224 and SHA-512/256 transforms
+ -- ref. NIST Draft FIPS 180-4 (February 2011)
+ - simplified shasum by removing duplicative text
+ - improved efficiency of Addfile
+ -- expensive -T test now occurs only in portable mode
+
5.50 Tue Dec 14 06:20:08 MST 2010
- adopted convention that '-' always means STDIN
-- actual filename '-' accessed as './-'
require 5.003000;
+use strict;
use ExtUtils::MakeMaker;
use Getopt::Std;
use Config;
-Digest::SHA version 5.50
+Digest::SHA version 5.60
========================
Digest::SHA is a complete implementation of the NIST Secure Hash
COPYRIGHT AND LICENSE
-Copyright (C) 2003-2010 Mark Shelor
+Copyright (C) 2003-2011 Mark Shelor
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
#include "src/hmac.c"
static int ix2alg[] =
- {1,1,1,224,224,224,256,256,256,384,384,384,512,512,512};
+ {1,1,1,224,224,224,256,256,256,384,384,384,512,512,512,
+ 512224,512224,512224,512256,512256,512256};
MODULE = Digest::SHA PACKAGE = Digest::SHA
Digest::SHA::sha512 = 12
Digest::SHA::sha512_hex = 13
Digest::SHA::sha512_base64 = 14
+ Digest::SHA::sha512224 = 15
+ Digest::SHA::sha512224_hex = 16
+ Digest::SHA::sha512224_base64 = 17
+ Digest::SHA::sha512256 = 18
+ Digest::SHA::sha512256_hex = 19
+ Digest::SHA::sha512256_base64 = 20
PREINIT:
int i;
unsigned char *data;
Digest::SHA::hmac_sha512 = 12
Digest::SHA::hmac_sha512_hex = 13
Digest::SHA::hmac_sha512_base64 = 14
+ Digest::SHA::hmac_sha512224 = 15
+ Digest::SHA::hmac_sha512224_hex = 16
+ Digest::SHA::hmac_sha512224_base64 = 17
+ Digest::SHA::hmac_sha512256 = 18
+ Digest::SHA::hmac_sha512256_hex = 19
+ Digest::SHA::hmac_sha512256_base64 = 20
PREINIT:
int i;
unsigned char *key;
use Fcntl;
use integer;
-$VERSION = '5.50';
+$VERSION = '5.60';
require Exporter;
require DynaLoader;
hmac_sha256 hmac_sha256_base64 hmac_sha256_hex
hmac_sha384 hmac_sha384_base64 hmac_sha384_hex
hmac_sha512 hmac_sha512_base64 hmac_sha512_hex
+ hmac_sha512224 hmac_sha512224_base64 hmac_sha512224_hex
+ hmac_sha512256 hmac_sha512256_base64 hmac_sha512256_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);
+ sha512 sha512_base64 sha512_hex
+ sha512224 sha512224_base64 sha512224_hex
+ sha512256 sha512256_base64 sha512256_hex);
# If possible, inherit from Digest::base (which depends on MIME::Base64)
$mode = defined($mode) ? $mode : "";
my ($binary, $portable) = map { $_ eq $mode } ("b", "p");
- my $text = -T $file;
## Always interpret "-" to mean STDIN; otherwise use
## sysopen to handle full range of POSIX file names
local *FH;
- $file eq '-' and open(FH, '< -')
+ $file eq '-' and open(FH, '< -')
or sysopen(FH, $file, O_RDONLY)
or _bail('Open failed');
binmode(FH) if $binary || $portable;
- unless ($portable && $text) {
+ unless ($portable && -T $file) {
$self->_addfile(*FH);
close(FH);
return($self);
=head1 ABSTRACT
-Digest::SHA is a complete implementation of the NIST Secure Hash
-Standard. It gives Perl programmers a convenient way to calculate
-SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 message digests.
-The module can handle all types of input, including partial-byte
-data.
+Digest::SHA is a complete implementation of the NIST Secure Hash Standard.
+It gives Perl programmers a convenient way to calculate SHA-1, SHA-224,
+SHA-256, SHA-384, SHA-512, SHA-512/224, and SHA-512/256 message digests.
+The module can handle all types of input, including partial-byte data.
=head1 DESCRIPTION
=item B<sha512($data, ...)>
+=item B<sha512224($data, ...)>
+
+=item B<sha512256($data, ...)>
+
Logically joins the arguments into a single string, and returns
its SHA-1/224/256/384/512 digest encoded as a binary string.
=item B<sha512_hex($data, ...)>
+=item B<sha512224_hex($data, ...)>
+
+=item B<sha512256_hex($data, ...)>
+
Logically joins the arguments into a single string, and returns
its SHA-1/224/256/384/512 digest encoded as a hexadecimal string.
=item B<sha512_base64($data, ...)>
+=item B<sha512224_base64($data, ...)>
+
+=item B<sha512256_base64($data, ...)>
+
Logically joins the arguments into a single string, and returns
its SHA-1/224/256/384/512 digest encoded as a Base64 string.
=item B<hmac_sha512($data, $key)>
+=item B<hmac_sha512224($data, $key)>
+
+=item B<hmac_sha512256($data, $key)>
+
Returns the HMAC-SHA-1/224/256/384/512 digest of I<$data>/I<$key>,
with the result encoded as a binary string. Multiple I<$data>
arguments are allowed, provided that I<$key> is the last argument
=item B<hmac_sha512_hex($data, $key)>
+=item B<hmac_sha512224_hex($data, $key)>
+
+=item B<hmac_sha512256_hex($data, $key)>
+
Returns the HMAC-SHA-1/224/256/384/512 digest of I<$data>/I<$key>,
with the result encoded as a hexadecimal string. Multiple I<$data>
arguments are allowed, provided that I<$key> is the last argument
=item B<hmac_sha512_base64($data, $key)>
+=item B<hmac_sha512224_base64($data, $key)>
+
+=item B<hmac_sha512256_base64($data, $key)>
+
Returns the HMAC-SHA-1/224/256/384/512 digest of I<$data>/I<$key>,
with the result encoded as a Base64 string. Multiple I<$data>
arguments are allowed, provided that I<$key> is the last argument
L<Digest>, L<Digest::SHA::PurePerl>
-The Secure Hash Standard (FIPS PUB 180-2) can be found at:
+The Secure Hash Standard (Draft FIPS PUB 180-4) can be found at:
-L<http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf>
+L<http://csrc.nist.gov/publications/drafts/fips180-4/Draft-FIPS180-4_Feb2011.pdf>
The Keyed-Hash Message Authentication Code (HMAC):
Gunnar Wolf
Adam Woodbury
-for their valuable comments and suggestions.
+"who by trained skill rescued life from such great billows and such thick
+darkness and moored it in so perfect a calm and in so brilliant a light"
+- Lucretius
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2003-2010 Mark Shelor
+Copyright (C) 2003-2011 Mark Shelor
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
## shasum: filter for computing SHA digests (ref. sha1sum/md5sum)
##
- ## Copyright (C) 2003-2010 Mark Shelor, All Rights Reserved
+ ## Copyright (C) 2003-2011 Mark Shelor, All Rights Reserved
##
- ## Version: 5.50
- ## Tue Dec 14 06:20:08 MST 2010
+ ## Version: 5.60
+ ## Thu Mar 3 05:26:42 MST 2011
+
+ ## shasum SYNOPSIS adapted from GNU Coreutils sha1sum.
+ ## Include an "-a" option for algorithm selection, and a
+ ## "-p" option for portable digest computation.
+
+my $POD = <<'END_OF_POD';
=head1 NAME
=head1 SYNOPSIS
- Usage: shasum [OPTION] [FILE]...
- or: shasum [OPTION] --check [FILE]
+ Usage: shasum [OPTION]... [FILE]...
Print or check SHA checksums.
With no FILE, or when FILE is -, read standard input.
- -a, --algorithm 1 (default), 224, 256, 384, 512
- -b, --binary read files in binary mode (default on DOS/Windows)
- -c, --check check SHA sums against given list
- -p, --portable read files in portable mode
+ -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
+ -p, --portable read files in portable mode
produces same digest on Windows/Unix/Mac
- -t, --text read files in text mode (default)
+ -t, --text read in text mode (default)
The following two options are useful only when verifying checksums:
+ -s, --status don't output anything, status code shows success
+ -w, --warn warn about improperly formatted checksum lines
+
+ -h, --help display this help and exit
+ -v, --version output version information and exit
- -s, --status don't output anything, status code shows success
- -w, --warn warn about improperly formatted SHA checksum lines
+ When verifying SHA-512/224 or SHA-512/256 checksums, indicate the
+ algorithm explicitly using the -a option, e.g.
- -h, --help display this help and exit
- -v, --version output version information and exit
+ shasum -a 512224 -c checksumfile
- The sums are computed as described in FIPS PUB 180-2. When checking,
- the input should be a former output of this program. The default mode
- is to print a line with checksum, a character indicating type (`*'
- for binary, `?' for portable, ` ' for text), and name for each FILE.
+ The sums are computed as described in FIPS-180-4. When checking, the
+ input should be a former output of this program. The default mode is to
+ print a line with checksum, a character indicating type (`*' for binary,
+ ` ' for text, `?' for portable), and name for each FILE.
+
+ Report shasum bugs to mshelor@cpan.org
=head1 DESCRIPTION
-The I<shasum> script provides the easiest and most convenient way to
-compute SHA message digests. Rather than writing a program, the user
-simply feeds data to the script via the command line, and waits for
-the results to be printed on standard output. Data can be fed to
-I<shasum> through files, standard input, or both.
+Running I<shasum> is often the quickest way to compute SHA message
+digests. The user simply feeds data to the script through files or
+standard input, and then collects the results from standard output.
The following command shows how easy it is to compute digests for typical
inputs such as the NIST test vector "abc":
perl -e "print qq(abc)" | shasum -a 256
-Since I<shasum> uses the same interface employed by the familiar
-I<sha1sum> program (and its somewhat outmoded anscestor I<md5sum>),
+Since I<shasum> mimics the behavior of the combined GNU I<sha1sum>,
+I<sha224sum>, I<sha256sum>, I<sha384sum>, and I<sha512sum> programs,
you can install this script as a convenient drop-in replacement.
=head1 AUTHOR
-Copyright (c) 2003-2010 Mark Shelor <mshelor@cpan.org>.
+Copyright (c) 2003-2011 Mark Shelor <mshelor@cpan.org>.
=head1 SEE ALSO
-shasum is implemented using the Perl module L<Digest::SHA> or
+I<shasum> is implemented using the Perl module L<Digest::SHA> or
L<Digest::SHA::PurePerl>.
=cut
+END_OF_POD
+
use strict;
-use FileHandle;
+use Fcntl;
use Getopt::Long;
-my $VERSION = "5.50";
+my $VERSION = "5.60";
- ## Try to use Digest::SHA, since it's faster. If not installed,
- ## use Digest::SHA::PurePerl instead.
+ ## Try to use Digest::SHA. If not installed, use the slower
+ ## but functionally equivalent Digest::SHA::PurePerl instead.
my $MOD_PREFER = "Digest::SHA";
my $MOD_SECOND = "Digest::SHA::PurePerl";
}
- ## Usage statement adapted from Ulrich Drepper's md5sum.
- ## Include an "-a" option for algorithm selection,
- ## and a "-p" option for portable digest computation.
-
sub usage {
my($err, $msg) = @_;
warn($msg . "Type shasum -h for help\n");
exit($err);
}
- print <<'END_OF_USAGE';
-Usage: shasum [OPTION] [FILE]...
- or: shasum [OPTION] --check [FILE]
-Print or check SHA checksums.
-With no FILE, or when FILE is -, read standard input.
-
- -a, --algorithm 1 (default), 224, 256, 384, 512
- -b, --binary read files in binary mode (default on DOS/Windows)
- -c, --check check SHA sums against given list
- -p, --portable read files in portable mode
- produces same digest on Windows/Unix/Mac
- -t, --text read files in text mode (default)
-
-The following two options are useful only when verifying checksums:
- -s, --status don't output anything, status code shows success
- -w, --warn warn about improperly formatted SHA checksum lines
-
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-The sums are computed as described in FIPS PUB 180-2. When checking, the
-input should be a former output of this program. The default mode is to
-print a line with checksum, a character indicating type (`*' for binary,
-`?' for portable, ` ' for text), and name for each FILE.
-
-Report bugs to <mshelor@cpan.org>.
-END_OF_USAGE
+ my($USAGE) = $POD =~ /SYNOPSIS\n\n(.+)\n=head1 DESCRIPTION\n/sm;
+ $USAGE =~ s/^ //gm;
+ print $USAGE;
exit($err);
}
## Sync stdout and stderr by forcing a flush after every write
-autoflush STDOUT 1;
-autoflush STDERR 1;
+select((select(STDOUT), $| = 1)[0]);
+select((select(STDERR), $| = 1)[0]);
## Collect options from command line
## Default to SHA-1 unless overriden by command line option
$alg = 1 unless defined $alg;
-grep { $_ == $alg } (1, 224, 256, 384, 512)
+grep { $_ == $alg } (1, 224, 256, 384, 512, 512224, 512256)
or usage(1, "shasum: Unrecognized algorithm\n");
## %len2alg: maps hex digest length to SHA algorithm
my %len2alg = (40 => 1, 56 => 224, 64 => 256, 96 => 384, 128 => 512);
+$len2alg{56} = 512224 if $alg == 512224;
+$len2alg{64} = 512256 if $alg == 512256;
## unescape: convert backslashed filename to plain filename
sub verify {
my $checkfile = shift;
my ($err, $fmt_errs, $read_errs, $match_errs) = (0, 0, 0, 0);
- my ($num_lines, $num_files, $num_checksums) = (0, 0, 0);
+ my ($num_lines, $num_files) = (0, 0);
my ($bslash, $sum, $fname, $rsp, $digest);
local *FH;
- $checkfile eq '-' and open(FH, '< -')
+ $checkfile eq '-' and open(FH, '< -')
and $checkfile = 'standard input'
or sysopen(FH, $checkfile, O_RDONLY)
or die "shasum: $checkfile: $!\n";
$err = 1; $read_errs++;
}
else {
- $num_checksums++;
if (lc($sum) eq $digest) { $rsp .= "OK\n" }
else { $rsp .= "FAILED\n"; $err = 1; $match_errs++ }
}
*
* Ref: FIPS PUB 198 The Keyed-Hash Message Authentication Code
*
- * Copyright (C) 2003-2010 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2011 Mark Shelor, All Rights Reserved
*
- * Version: 5.50
- * Tue Dec 14 06:20:08 MST 2010
+ * Version: 5.60
+ * Thu Mar 3 05:26:42 MST 2011
*
*/
*
* Ref: FIPS PUB 198 The Keyed-Hash Message Authentication Code
*
- * Copyright (C) 2003-2010 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2011 Mark Shelor, All Rights Reserved
*
- * Version: 5.50
- * Tue Dec 14 06:20:08 MST 2010
+ * Version: 5.60
+ * Thu Mar 3 05:26:42 MST 2011
*
*/
#ifndef SHA_PERL_MODULE
-unsigned char *hmac1digest (_HMAC_DATA, _HMAC_KEY);
-char *hmac1hex (_HMAC_DATA, _HMAC_KEY);
-char *hmac1base64 (_HMAC_DATA, _HMAC_KEY);
-unsigned char *hmac224digest (_HMAC_DATA, _HMAC_KEY);
-char *hmac224hex (_HMAC_DATA, _HMAC_KEY);
-char *hmac224base64 (_HMAC_DATA, _HMAC_KEY);
-unsigned char *hmac256digest (_HMAC_DATA, _HMAC_KEY);
-char *hmac256hex (_HMAC_DATA, _HMAC_KEY);
-char *hmac256base64 (_HMAC_DATA, _HMAC_KEY);
-unsigned char *hmac384digest (_HMAC_DATA, _HMAC_KEY);
-char *hmac384hex (_HMAC_DATA, _HMAC_KEY);
-char *hmac384base64 (_HMAC_DATA, _HMAC_KEY);
-unsigned char *hmac512digest (_HMAC_DATA, _HMAC_KEY);
-char *hmac512hex (_HMAC_DATA, _HMAC_KEY);
-char *hmac512base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac1digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac1hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac1base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac224digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac224hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac224base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac256digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac256hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac256base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac384digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac384hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac384base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac512digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac512hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac512base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac512224digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac512224hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac512224base64 (_HMAC_DATA, _HMAC_KEY);
+unsigned char *hmac512256digest (_HMAC_DATA, _HMAC_KEY);
+char *hmac512256hex (_HMAC_DATA, _HMAC_KEY);
+char *hmac512256base64 (_HMAC_DATA, _HMAC_KEY);
#endif
*
* Ref: NIST FIPS PUB 180-2 Secure Hash Standard
*
- * Copyright (C) 2003-2010 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2011 Mark Shelor, All Rights Reserved
*
- * Version: 5.50
- * Tue Dec 14 06:20:08 MST 2010
+ * Version: 5.60
+ * Thu Mar 3 05:26:42 MST 2011
*
*/
else if (s->alg == SHA256) SHA_INIT(256, 256);
else if (s->alg == SHA384) SHA_INIT(384, 512);
else if (s->alg == SHA512) SHA_INIT(512, 512);
+ else if (s->alg == SHA512224) SHA_INIT(512224, 512);
+ else if (s->alg == SHA512256) SHA_INIT(512256, 512);
}
/* shaopen: creates a new digest object */
SHA *s;
if (alg != SHA1 && alg != SHA224 && alg != SHA256 &&
- alg != SHA384 && alg != SHA512)
+ alg != SHA384 && alg != SHA512 &&
+ alg != SHA512224 && alg != SHA512256)
return(NULL);
if (alg >= SHA384 && !sha_384_512)
return(NULL);
*
* Ref: NIST FIPS PUB 180-2 Secure Hash Standard
*
- * Copyright (C) 2003-2010 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2011 Mark Shelor, All Rights Reserved
*
- * Version: 5.50
- * Tue Dec 14 06:20:08 MST 2010
+ * Version: 5.60
+ * Thu Mar 3 05:26:42 MST 2011
*
*/
#define SHA_getc fgetc
#endif
-#define SHA1 1
-#define SHA224 224
-#define SHA256 256
-#define SHA384 384
-#define SHA512 512
+#define SHA1 1
+#define SHA224 224
+#define SHA256 256
+#define SHA384 384
+#define SHA512 512
+#define SHA512224 512224
+#define SHA512256 512256
#define SHA1_BLOCK_BITS 512
#define SHA224_BLOCK_BITS SHA1_BLOCK_BITS
#define SHA256_BLOCK_BITS SHA1_BLOCK_BITS
#define SHA384_BLOCK_BITS 1024
#define SHA512_BLOCK_BITS SHA384_BLOCK_BITS
+#define SHA512224_BLOCK_BITS SHA512_BLOCK_BITS
+#define SHA512256_BLOCK_BITS SHA512_BLOCK_BITS
#define SHA1_DIGEST_BITS 160
#define SHA224_DIGEST_BITS 224
#define SHA256_DIGEST_BITS 256
#define SHA384_DIGEST_BITS 384
#define SHA512_DIGEST_BITS 512
+#define SHA512224_DIGEST_BITS 224
+#define SHA512256_DIGEST_BITS 256
#define SHA_MAX_BLOCK_BITS SHA512_BLOCK_BITS
#define SHA_MAX_DIGEST_BITS SHA512_DIGEST_BITS
#ifndef SHA_PERL_MODULE
-unsigned char *sha1digest (_SHA_DATA);
-char *sha1hex (_SHA_DATA);
-char *sha1base64 (_SHA_DATA);
-unsigned char *sha224digest (_SHA_DATA);
-char *sha224hex (_SHA_DATA);
-char *sha224base64 (_SHA_DATA);
-unsigned char *sha256digest (_SHA_DATA);
-char *sha256hex (_SHA_DATA);
-char *sha256base64 (_SHA_DATA);
-unsigned char *sha384digest (_SHA_DATA);
-char *sha384hex (_SHA_DATA);
-char *sha384base64 (_SHA_DATA);
-unsigned char *sha512digest (_SHA_DATA);
-char *sha512hex (_SHA_DATA);
-char *sha512base64 (_SHA_DATA);
+unsigned char *sha1digest (_SHA_DATA);
+char *sha1hex (_SHA_DATA);
+char *sha1base64 (_SHA_DATA);
+unsigned char *sha224digest (_SHA_DATA);
+char *sha224hex (_SHA_DATA);
+char *sha224base64 (_SHA_DATA);
+unsigned char *sha256digest (_SHA_DATA);
+char *sha256hex (_SHA_DATA);
+char *sha256base64 (_SHA_DATA);
+unsigned char *sha384digest (_SHA_DATA);
+char *sha384hex (_SHA_DATA);
+char *sha384base64 (_SHA_DATA);
+unsigned char *sha512digest (_SHA_DATA);
+char *sha512hex (_SHA_DATA);
+char *sha512base64 (_SHA_DATA);
+unsigned char *sha512224digest (_SHA_DATA);
+char *sha512224hex (_SHA_DATA);
+char *sha512224base64 (_SHA_DATA);
+unsigned char *sha512256digest (_SHA_DATA);
+char *sha512256hex (_SHA_DATA);
+char *sha512256base64 (_SHA_DATA);
#endif
C64(0x1f83d9abfb41bd6b), C64(0x5be0cd19137e2179)
};
+static W64 H0512224[8] = /* SHA-512/224 initial hash value */
+{
+C64(0x8c3d37c819544da2), C64(0x73e1996689dcd4d6), C64(0x1dfab7ae32ff9c82),
+C64(0x679dd514582f9fcf), C64(0x0f6d2b697bd44da8), C64(0x77e36f7304c48942),
+C64(0x3f9d85a86a1d36c8), C64(0x1112e6ad91d692a1)
+
+};
+static W64 H0512256[8] = /* SHA-512/256 initial hash value */
+{
+C64(0x22312194fc2bf72c), C64(0x9f555fa3c84c64c2), C64(0x2393b86b6f53b151),
+C64(0x963877195940eabd), C64(0x96283ee2a88effe3), C64(0xbe5e1e2553863992),
+C64(0x2b0199fc2c85b8aa), C64(0x0eb72ddc81c52ca2)
+};
+
/* strto64: converts hex string to a 64-bit word */
static W64 strto64(char *s)
{
--- /dev/null
+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';
+ @INC = '../lib';
+ }
+}
+
+my @vecs = map { eval } <DATA>;
+# $#vecs -= 2 if $MODULE eq "Digest::SHA::PurePerl";
+
+my $numtests = scalar(@vecs) / 2;
+print "1..$numtests\n";
+
+my $skip = sha512_hex("") ? 0 : 1;
+
+for (1 .. $numtests) {
+ my $data = shift @vecs;
+ my $digest = shift @vecs;
+ unless ($skip) {
+ my $rsp = ($_ <= $numtests/2) ?
+ sha512224_hex($data) : sha512256_hex($data);
+ print "not " unless $rsp eq $digest;
+ }
+ print "ok ", $_, $skip ? " # skip: no 64 bit" : "", "\n";
+}
+
+__DATA__
+"abc"
+"4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa"
+"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
+"23fec5bb94d60b23308192640b0c453335d664734fe40e7268674af9"
+"abc"
+"53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23"
+"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
+"3928e184fb8690f840da3988121d31be65cb9d3ef83ee6146feac861e19b563a"
=item *
+C<Digest::SHA> has been upgraded from version 5.50 to 5.60
+
+New SHA-512/224 and SHA-512/256 transforms ref. NIST Draft FIPS 180-4 (February 2011)
+
+=item *
+
C<ExtUtils::Command> has been upgraded from version 1.16 to 1.17.
=item *