summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2014-01-30 15:43:37 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2014-01-30 15:43:37 +0000
commite80e3195a56ee8ba20dc0e0f5d5381af5ec5ac33 (patch)
treeab43f81ff3211b0001202cc013b44bccc95035ff /cpan
parent5fa7380be80a400bbc197a187003ba883b639819 (diff)
downloadperl-e80e3195a56ee8ba20dc0e0f5d5381af5ec5ac33.tar.gz
Update Digest-SHA to CPAN version 5.86
[DELTA] 5.86 Thu Jan 30 08:24:28 MST 2014 - improved the performance of hexadecimal output functions -- ref. 'shahex' in src/sha.c -- thanks to Thomas Drugeon for ideas and test script
Diffstat (limited to 'cpan')
-rw-r--r--cpan/Digest-SHA/lib/Digest/SHA.pm4
-rw-r--r--cpan/Digest-SHA/shasum10
-rw-r--r--cpan/Digest-SHA/src/sha.c31
-rw-r--r--cpan/Digest-SHA/src/sha.h6
4 files changed, 30 insertions, 21 deletions
diff --git a/cpan/Digest-SHA/lib/Digest/SHA.pm b/cpan/Digest-SHA/lib/Digest/SHA.pm
index 9f94136da0..d8c9aec174 100644
--- a/cpan/Digest-SHA/lib/Digest/SHA.pm
+++ b/cpan/Digest-SHA/lib/Digest/SHA.pm
@@ -7,7 +7,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
use Fcntl;
use integer;
-$VERSION = '5.85';
+$VERSION = '5.86';
require Exporter;
require DynaLoader;
@@ -733,7 +733,7 @@ darkness and moored it in so perfect a calm and in so brilliant a light"
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2003-2013 Mark Shelor
+Copyright (C) 2003-2014 Mark Shelor
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
diff --git a/cpan/Digest-SHA/shasum b/cpan/Digest-SHA/shasum
index 381a980552..0026a254f7 100644
--- a/cpan/Digest-SHA/shasum
+++ b/cpan/Digest-SHA/shasum
@@ -2,10 +2,10 @@
## shasum: filter for computing SHA digests (ref. sha1sum/md5sum)
##
- ## Copyright (C) 2003-2013 Mark Shelor, All Rights Reserved
+ ## Copyright (C) 2003-2014 Mark Shelor, All Rights Reserved
##
- ## Version: 5.85
- ## Wed Jun 26 04:05:26 MST 2013
+ ## Version: 5.86
+ ## Thu Jan 30 08:24:28 MST 2014
## shasum SYNOPSIS adapted from GNU Coreutils sha1sum.
## Add an "-a" option for algorithm selection, a "-p"
@@ -82,7 +82,7 @@ the 7-bit message I<0001100>:
=head1 AUTHOR
-Copyright (c) 2003-2013 Mark Shelor <mshelor@cpan.org>.
+Copyright (c) 2003-2014 Mark Shelor <mshelor@cpan.org>.
=head1 SEE ALSO
@@ -97,7 +97,7 @@ use strict;
use Fcntl;
use Getopt::Long;
-my $VERSION = "5.85";
+my $VERSION = "5.86";
## Try to use Digest::SHA. If not installed, use the slower
diff --git a/cpan/Digest-SHA/src/sha.c b/cpan/Digest-SHA/src/sha.c
index d989d6ce78..9554c25243 100644
--- a/cpan/Digest-SHA/src/sha.c
+++ b/cpan/Digest-SHA/src/sha.c
@@ -3,10 +3,10 @@
*
* Ref: NIST FIPS PUB 180-2 Secure Hash Standard
*
- * Copyright (C) 2003-2013 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2014 Mark Shelor, All Rights Reserved
*
- * Version: 5.85
- * Wed Jun 26 04:05:26 MST 2013
+ * Version: 5.86
+ * Thu Jan 30 08:24:28 MST 2014
*
*/
@@ -423,22 +423,31 @@ static UCHR *shadigest(SHA *s)
return(s->digest);
}
+/* xmap: translation map for hexadecimal encoding */
+static char xmap[] =
+ "0123456789abcdef";
+
/* shahex: returns pointer to current digest (hexadecimal) */
static char *shahex(SHA *s)
{
int i;
+ char *h;
+ UCHR *d;
digcpy(s);
s->hex[0] = '\0';
if (HEXLEN((size_t) s->digestlen) >= sizeof(s->hex))
return(s->hex);
- for (i = 0; i < s->digestlen; i++)
- sprintf(s->hex+i*2, "%02x", s->digest[i]);
+ for (i = 0, h = s->hex, d = s->digest; i < s->digestlen; i++) {
+ *h++ = xmap[(*d >> 4) & 0x0f];
+ *h++ = xmap[(*d++ ) & 0x0f];
+ }
+ *h = '\0';
return(s->hex);
}
-/* map: translation map for Base 64 encoding */
-static char map[] =
+/* bmap: translation map for Base 64 encoding */
+static char bmap[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/* encbase64: encodes input (0 to 3 bytes) into Base 64 */
@@ -450,10 +459,10 @@ static void encbase64(UCHR *in, int n, char *out)
if (n < 1 || n > 3)
return;
memcpy(byte, in, n);
- out[0] = map[byte[0] >> 2];
- out[1] = map[((byte[0] & 0x03) << 4) | (byte[1] >> 4)];
- out[2] = map[((byte[1] & 0x0f) << 2) | (byte[2] >> 6)];
- out[3] = map[byte[2] & 0x3f];
+ out[0] = bmap[byte[0] >> 2];
+ out[1] = bmap[((byte[0] & 0x03) << 4) | (byte[1] >> 4)];
+ out[2] = bmap[((byte[1] & 0x0f) << 2) | (byte[2] >> 6)];
+ out[3] = bmap[byte[2] & 0x3f];
out[n+1] = '\0';
}
diff --git a/cpan/Digest-SHA/src/sha.h b/cpan/Digest-SHA/src/sha.h
index b38b1fd06b..a50b25ea65 100644
--- a/cpan/Digest-SHA/src/sha.h
+++ b/cpan/Digest-SHA/src/sha.h
@@ -3,10 +3,10 @@
*
* Ref: NIST FIPS PUB 180-2 Secure Hash Standard
*
- * Copyright (C) 2003-2013 Mark Shelor, All Rights Reserved
+ * Copyright (C) 2003-2014 Mark Shelor, All Rights Reserved
*
- * Version: 5.85
- * Wed Jun 26 04:05:26 MST 2013
+ * Version: 5.86
+ * Thu Jan 30 08:24:28 MST 2014
*
*/