r63219 - in /trunk/libdigest-crc-perl: CRC.xs Changes README debian/changelog debian/compat debian/control debian/copyright debian/rules debian/source/ debian/source/format lib/Digest/CRC.pm t/crc.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sun Oct 3 16:28:53 UTC 2010


Author: ansgar-guest
Date: Sun Oct  3 16:28:34 2010
New Revision: 63219

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=63219
Log:
* New upstream release.
* debian/control: Update description.
* debian/control: Make build-dep on perl unversioned.
* Use tiny debian/rules with debhelper 7.  Use Makefile.PL as Build.PL does
  not build the XS module.
* Use source format 3.0 (quilt).
* Convert debian/copyright to proposed machine-readable format.
* Bump Standards-Version to 3.9.1.
* Add myself to Uploaders.

Added:
    trunk/libdigest-crc-perl/debian/source/
    trunk/libdigest-crc-perl/debian/source/format
Modified:
    trunk/libdigest-crc-perl/CRC.xs
    trunk/libdigest-crc-perl/Changes
    trunk/libdigest-crc-perl/README
    trunk/libdigest-crc-perl/debian/changelog
    trunk/libdigest-crc-perl/debian/compat
    trunk/libdigest-crc-perl/debian/control
    trunk/libdigest-crc-perl/debian/copyright
    trunk/libdigest-crc-perl/debian/rules
    trunk/libdigest-crc-perl/lib/Digest/CRC.pm
    trunk/libdigest-crc-perl/t/crc.t

Modified: trunk/libdigest-crc-perl/CRC.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/CRC.xs?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/CRC.xs (original)
+++ trunk/libdigest-crc-perl/CRC.xs Sun Oct  3 16:28:34 2010
@@ -148,3 +148,45 @@
 
         OUTPUT:
 		RETVAL
+
+SV *
+_crc64(message)
+          SV * message
+
+          PREINIT:
+                  unsigned long long poly64rev = 0xd800000000000000ULL;
+                  unsigned long long crc = 0x0000000000000000ULL;
+                  unsigned long long part;
+                  int i, j;
+                  static int init = 0;
+                  static unsigned long long CRCTable[256];
+                  STRLEN len;
+                  const char *msg, *end;
+
+          CODE:
+               SvGETMAGIC(message);
+               msg = SvPV(message, len);
+               end = msg + len;
+
+               if (!init) {
+                 init = 1;
+
+                 for (i = 0; i < 256; i++) {
+                   part = i;
+                   for (j = 0; j < 8; j++) {
+                     if (part & 1)
+                       part = (part >> 1) ^ poly64rev;
+                     else
+                       part >>= 1;
+                   }
+                   CRCTable[i] = part;
+                 }
+               }
+               while (msg < end)
+                 crc = CRCTable[(crc ^ *msg++) & 0xff] ^ (crc >> 8);
+
+               RETVAL = newSVuv(crc);
+
+        OUTPUT:
+               RETVAL
+

Modified: trunk/libdigest-crc-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/Changes?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/Changes (original)
+++ trunk/libdigest-crc-perl/Changes Sun Oct  3 16:28:34 2010
@@ -40,3 +40,13 @@
 0.14  Mon Nov  5 08:10:11 2007
         - fixed __reflect error in non XS part
 
+0.15  Sun Sep 12 13:46:13 2010
+        - added crc64 support, #50064
+          Thanks to Anders Ossowicki <aowi at novozymes.com>
+        - added bit reversing per byte, #59575
+          Thanks to Joel Peshkin <joel at peshkin.net>
+        - clone method nwo copies content too
+          Thanks to Stefan Ochs <stefan.ochs at opentext.com>
+
+0.16  Wed Sep 29 08:11:42 2010
+        - fixed crc64 support for non-xs case, #61490, #61491

Modified: trunk/libdigest-crc-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/README?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/README (original)
+++ trunk/libdigest-crc-perl/README Sun Oct  3 16:28:34 2010
@@ -1,4 +1,4 @@
-Digest::CRC version 0.14
+Digest::CRC version 0.16
 ========================
 
 NAME

Modified: trunk/libdigest-crc-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/changelog?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/debian/changelog (original)
+++ trunk/libdigest-crc-perl/debian/changelog Sun Oct  3 16:28:34 2010
@@ -1,4 +1,4 @@
-libdigest-crc-perl (0.14-3) UNRELEASED; urgency=low
+libdigest-crc-perl (0.16-1) unstable; urgency=low
 
   [ Joachim Breitner ]
   * Removed myself from uploaders.
@@ -9,7 +9,18 @@
   * debian/control: Added: ${misc:Depends} to Depends: field.
   * Change my email address.
 
- -- Joachim Breitner <nomeata at debian.org>  Wed, 13 Feb 2008 23:28:12 +0000
+  [ Ansgar Burchardt ]
+  * New upstream release.
+  * debian/control: Update description.
+  * debian/control: Make build-dep on perl unversioned.
+  * Use tiny debian/rules with debhelper 7.  Use Makefile.PL as Build.PL does
+    not build the XS module.
+  * Use source format 3.0 (quilt).
+  * Convert debian/copyright to proposed machine-readable format.
+  * Bump Standards-Version to 3.9.1.
+  * Add myself to Uploaders.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sun, 03 Oct 2010 18:27:50 +0200
 
 libdigest-crc-perl (0.14-2) unstable; urgency=low
 

Modified: trunk/libdigest-crc-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/compat?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/debian/compat (original)
+++ trunk/libdigest-crc-perl/debian/compat Sun Oct  3 16:28:34 2010
@@ -1,1 +1,1 @@
-6
+7

Modified: trunk/libdigest-crc-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/control?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/debian/control (original)
+++ trunk/libdigest-crc-perl/debian/control Sun Oct  3 16:28:34 2010
@@ -3,18 +3,19 @@
 Priority: optional
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Allard Hoeve <allard at byte.nl>, Gunnar Wolf <gwolf at debian.org>, 
- gregor herrmann <gregoa at debian.org>, Damyan Ivanov <dmn at debian.org>
-Standards-Version: 3.7.3
+ gregor herrmann <gregoa at debian.org>, Damyan Ivanov <dmn at debian.org>,
+ Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.9.1
 Homepage: http://search.cpan.org/dist/Digest-CRC/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdigest-crc-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libdigest-crc-perl/
-Build-Depends: debhelper (>= 6), perl (>= 5.8)
+Build-Depends: debhelper (>= 7.0.50~), perl
 
 Package: libdigest-crc-perl
 Architecture: any
 Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
-Description:  Generic CRC functions for Perl
+Description: Perl module providing generic CRC functions
  The Digest::CRC module calculates CRC sums of all sorts.
  It contains wrapper functions with the correct parameters for CRC-CCITT,
- CRC-16 and CRC-32. The module acts similar to libstring-crc32-perl, but 
- implements the Digest interface.
+ CRC-16, CRC-32 and CRC-64. The module acts similar to libstring-crc32-perl,
+ but implements the Digest interface.

Modified: trunk/libdigest-crc-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/copyright?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/debian/copyright (original)
+++ trunk/libdigest-crc-perl/debian/copyright Sun Oct  3 16:28:34 2010
@@ -1,27 +1,38 @@
-This is the debian package for the Digest-CRC module.
-It was created by Allard Hoeve <allard at byte.nl> using dh-make-perl,
-and is maintained by the Debian Perl Group.
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: Oliver Maul <oli at 42.nu>
+Source: http://search.cpan.org/dist/Digest-CRC/
+Name: Digest-CRC
 
-Upstream URL:
-http://search.cpan.org/dist/Digest-CRC/
+Copyright: None (public domain)
+License: other
+ CRC algorithm code taken from "A PAINLESS GUIDE TO CRC ERROR DETECTION
+ ALGORITHMS".
+ .
+ The author of this package disclaims all copyrights and releases it
+ into the public domain.
 
-The upstream author is: 
-Oliver Maul, oli at 42.nu
+Files: debian/*
+Copyright:
+ 2004, Allard Hoeve <allard at byte.nl>
+ 2006, Gunnar Wolf <gwolf at debian.org>
+ 2007, gregor herrmann <gregoa at debian.org>
+ 2008, Damyan Ivanov <dmn at debian.org>
+ 2008, Joachim Breitner <nomeata at debian.org>
+ 2010, Ansgar Burchardt <ansgar at 43-1.org>
+License: Artistic or GPL-1+
 
-Copyright and License:
-CRC algorithm code taken from "A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS".
+License: Artistic
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
 
-The authors of both this package and the algorithm code disclaim all copyrights
-and release them into the public domain.
-
-
-Debian specific changes are copyrighted:
-
- Copyright (c) 2004, 2006, 2007, 2008 Debian Perl Group.  All rights reserved.
- Debian specific changes are free; you may redistribute them and/or modify
- them under the same terms as Perl itself.
-
- Perl is distributed under your choice of the GNU General Public License or
- the Artistic License.  On Debian GNU/Linux systems, the complete text of the
- GNU General Public License can be found in `/usr/share/common-licenses/GPL'
- and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+License: GPL-1+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.

Modified: trunk/libdigest-crc-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/rules?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/debian/rules (original)
+++ trunk/libdigest-crc-perl/debian/rules Sun Oct  3 16:28:34 2010
@@ -1,87 +1,7 @@
 #!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+%:
+	dh $@ --buildsystem=perl_makemaker
 
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP     =$(CURDIR)/debian/$(PACKAGE)
-
-# Allow disabling build optimation by setting noopt in
-# $DEB_BUILD_OPTIONS
-CFLAGS = -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-        CFLAGS += -O0
-else
-        CFLAGS += -O2
-endif
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-
-	$(PERL) Makefile.PL INSTALLDIRS=vendor
-	$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
-	$(MAKE) test
-
-	touch $@
-
-clean:
-	dh_testdir
-	dh_testroot
-
-	dh_clean build-stamp install-stamp
-	[ ! -f Makefile ] || $(MAKE) realclean
-
-install: install-stamp
-install-stamp: build-stamp
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-
-	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-	
-	# As this is a architecture dependent package, we are not supposed to install
-	# stuff to /usr/share/perl5. MakeMaker creates the dirs, we delete them from 
-	# the deb:
-	[ ! -d $(TMP)/usr/share/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/share/perl5
-	
-	touch $@
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs
-	dh_installchangelogs Changes
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_perl
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-source diff:                                                                  
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+override_dh_auto_test:
+	WITH_CRC64=1 dh_auto_test --buildsystem=perl_makemaker

Added: trunk/libdigest-crc-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/debian/source/format?rev=63219&op=file
==============================================================================
--- trunk/libdigest-crc-perl/debian/source/format (added)
+++ trunk/libdigest-crc-perl/debian/source/format Sun Oct  3 16:28:34 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libdigest-crc-perl/lib/Digest/CRC.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/lib/Digest/CRC.pm?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/lib/Digest/CRC.pm (original)
+++ trunk/libdigest-crc-perl/lib/Digest/CRC.pm Sun Oct  3 16:28:34 2010
@@ -8,15 +8,16 @@
 @ISA = qw(Exporter);
 
 @EXPORT_OK = qw(
- crc8 crcccitt crc16 crc32 crc
+ crc8 crcccitt crc16 crc32 crc64 crc
  crc_hex crc_base64
  crcccitt_hex crcccitt_base64
  crc8_hex crc8_base64
  crc16_hex crc16_base64
  crc32_hex crc32_base64
+ crc64_hex crc64_base64
 );
 
-$VERSION    = '0.14';
+$VERSION    = '0.16';
 $XS_VERSION = $VERSION;
 $VERSION    = eval $VERSION;
 
@@ -41,9 +42,9 @@
 }
 
 # Only load the non-XS stuff on demand
-defined &_crc or eval <<'ENOXS';
-
-sub _reflect {
+defined &_crc or eval <<'ENOXS' or die $@;
+
+sub _reflect($$) {
   my ($in, $width) = @_;
   my $out = 0;
   for(my $i=1; $i < ($width+1); $i++) {
@@ -53,7 +54,7 @@
   $out;
 }
 
-sub _tabinit {
+sub _tabinit($$$) {
   my ($width,$poly_in,$ref) = @_;
   my @crctab;
   my $poly = $poly_in;
@@ -82,10 +83,14 @@
   \@crctab;
 }
 
-sub _crc {
+sub _crc($$$$$$$) {
   my ($message,$width,$init,$xorout,$refin,$refout,$tab) = @_;
   my $crc = $init;
-  $crc = _reflect($crc,$width) if $refin;
+  if ($refin == 1) {
+    $crc = _reflect($crc,$width);
+  } elsif ($refin > 1 and $refin <= $width) {
+    $crc = _reflect($crc,$refin);
+  }
   my $pos = -length $message;
   my $mask = 2**$width-1;
   while ($pos) {
@@ -96,13 +101,19 @@
     }
   }
 
-  if ($refout^$refin) {
-    $crc = _reflect($crc,$width);
+  if ($refout && !$refin) {
+    if ($refout == 1) {
+      $crc = _reflect($crc,$width);
+    } elsif ($refout > 1 and $refout <= $width) {
+      $crc = _reflect($crc,$refout);
+    }
   }
 
   $crc = $crc ^ $xorout;
   $crc & $mask;
 }
+
+1;
 
 ENOXS
 
@@ -232,7 +243,8 @@
     xorout => $self->{xorout},
     poly => $self->{poly},
     refin => $self->{refin},
-    refout => $self->{refout}
+    refout => $self->{refout},
+    _data => $self->{_data}
   };
   bless $clone, ref $self || $self;
 }
@@ -267,6 +279,11 @@
 
 sub crc32 { crc($_[0],@{$_typedef{crc32}}) }
 
+# CRC64
+# special XS implementation (_crc64)
+
+sub crc64 { _crc64($_[0]) }
+
 sub crc_hex { _encode_hex &crc }
 
 sub crc_base64 { _encode_base64 &crc }
@@ -286,6 +303,10 @@
 sub crc32_hex { _encode_hex &crc32 }
 
 sub crc32_base64 { _encode_base64 &crc32 }
+
+sub crc64_hex { _encode_hex &crc64 }
+
+sub crc64_base64 { _encode_base64 &crc64 }
 
 1;
 __END__
@@ -298,7 +319,8 @@
 
   # Functional style
 
-  use Digest::CRC qw(crc32 crc16 crcccitt crc crc8);
+  use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc crc8);
+  $crc = crc64("123456789");
   $crc = crc32("123456789");
   $crc = crc16("123456789");
   $crc = crcccitt("123456789");
@@ -325,7 +347,7 @@
 
 The B<Digest::CRC> module calculates CRC sums of all sorts.
 It contains wrapper functions with the correct parameters for CRC-CCITT,
-CRC-16 and CRC-32.
+CRC-16, CRC-32 and CRC-64.
 
 =head1 AUTHOR
 

Modified: trunk/libdigest-crc-perl/t/crc.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-crc-perl/t/crc.t?rev=63219&op=diff
==============================================================================
--- trunk/libdigest-crc-perl/t/crc.t (original)
+++ trunk/libdigest-crc-perl/t/crc.t Sun Oct  3 16:28:34 2010
@@ -1,5 +1,8 @@
 BEGIN {
   $tests = 20;
+  if ($ENV{'WITH_CRC64'}) {
+    $tests++;
+  }
   $| = 1;
 
   eval "use Test::More tests => $tests";
@@ -18,11 +21,16 @@
 ENDEV
 }
 
-use Digest::CRC qw(crc32 crc16 crcccitt crc8);
+use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc8);
 ok(1, 'use');
 
 my $input = "123456789";
 my ($crc32,$crc16,$crcccitt,$crc8) = (crc32($input),crc16($input),crcccitt($input),crc8($input));
+
+if ($ENV{'WITH_CRC64'}) {
+  my $crc64 = crc64($input);
+  ok($crc64 == 5090661014116757502, 'crc64 '.$crc64); 
+}
 
 ok($crc32 == 3421780262, 'crc32'); 
 $crc32=$crc32^0xffffffff;
@@ -45,7 +53,7 @@
 $ctx->addfile(F);
 close(F);
 my $y = $ctx->digest;
-ok($y == 2371909219, 'OO crc32 with addfile '.$y); 
+ok($y == 3439495136, 'OO crc32 with addfile '.$y); 
 
 # start at offset >0 with previous checksum result
 $ctx = Digest::CRC->new(type=>"crc32",cont=>1,init=>460478609); 




More information about the Pkg-perl-cvs-commits mailing list