Update Digest-SHA to CPAN version 5.86
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 30 Jan 2014 15:43:37 +0000 (15:43 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Thu, 30 Jan 2014 15:43:37 +0000 (15:43 +0000)
  [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

Porting/Maintainers.pl
cpan/Digest-SHA/lib/Digest/SHA.pm
cpan/Digest-SHA/shasum
cpan/Digest-SHA/src/sha.c
cpan/Digest-SHA/src/sha.h

index c3856fb..f88ab04 100755 (executable)
@@ -384,7 +384,7 @@ use File::Glob qw(:case);
     },
 
     'Digest::SHA' => {
-        'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.85.tar.gz',
+        'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.86.tar.gz',
         'FILES'        => q[cpan/Digest-SHA],
         'EXCLUDED'     => [
             qw( t/pod.t
index 9f94136..d8c9aec 100644 (file)
@@ -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.
index 381a980..0026a25 100644 (file)
@@ -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
index d989d6c..9554c25 100644 (file)
@@ -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';
 }
 
index b38b1fd..a50b25e 100644 (file)
@@ -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
  *
  */