Hello community, here is the log from the commit of package perl-Digest-CRC for openSUSE:Factory checked in at 2012-02-16 14:59:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Digest-CRC (Old) and /work/SRC/openSUSE:Factory/.perl-Digest-CRC.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Digest-CRC", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Digest-CRC/perl-Digest-CRC.changes 2011-11-21 12:39:21.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Digest-CRC.new/perl-Digest-CRC.changes 2012-02-16 14:59:22.000000000 +0100 @@ -1,0 +2,6 @@ +Wed Feb 15 18:04:12 UTC 2012 - opensuse@dstoecker.de + +- update to new 0.18 bug-fix release +- added openpgparmor support + +------------------------------------------------------------------- @@ -40,0 +47 @@ +------------------------------------------------------------------- Old: ---- Digest-CRC-0.17.tar.gz New: ---- Digest-CRC-0.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Digest-CRC.spec ++++++ --- /var/tmp/diff_new_pack.v3bayL/_old 2012-02-16 14:59:23.000000000 +0100 +++ /var/tmp/diff_new_pack.v3bayL/_new 2012-02-16 14:59:23.000000000 +0100 @@ -18,7 +18,7 @@ Name: perl-Digest-CRC -Version: 0.17 +Version: 0.18 Release: 1 AutoReqProv: on Group: Development/Libraries/Perl ++++++ Digest-CRC-0.17.tar.gz -> Digest-CRC-0.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Digest-CRC-0.17/CRC.xs new/Digest-CRC-0.18/CRC.xs --- old/Digest-CRC-0.17/CRC.xs 2011-08-27 14:22:37.000000000 +0200 +++ new/Digest-CRC-0.18/CRC.xs 2011-11-12 23:15:45.000000000 +0100 @@ -31,7 +31,7 @@ int i; UV out = 0; - for (i = width; in; i--, in >>= 1) + for (i = width; in && i; i--, in >>= 1) out = (out << 1) | (in & 1); return out << i; @@ -123,18 +123,19 @@ CODE: SvGETMAGIC(message); - if (cont) { - init = (init ^ xorout); - if (refin) - init = reflect(init, width); - } - crc = refin ? reflect(init, width) : init; msg = SvPV(message, len); end = msg + len; mask = ((UV)1)<<(width-1); mask = mask + (mask-1); tab = (UV *) SvPVX(table); + crc = refin ? reflect(init, width) : init; + if (cont) { + crc = (init ^ xorout) & mask; + if (refout ^ refin) + crc = reflect(crc, width); + } + if (refin) { while (msg < end) crc = (crc >> 8) ^ tab[(crc ^ *msg++) & 0xFF]; @@ -156,12 +157,12 @@ RETVAL SV * -_crc64(message) +_crc64(message, crc=0) SV * message + UV crc PREINIT: unsigned long long poly64rev = 0xd800000000000000ULL; - unsigned long long crc = 0x0000000000000000ULL; unsigned long long part; int i, j; static int init = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Digest-CRC-0.17/Changes new/Digest-CRC-0.18/Changes --- old/Digest-CRC-0.17/Changes 2011-08-27 14:00:50.000000000 +0200 +++ new/Digest-CRC-0.18/Changes 2011-11-12 23:19:55.000000000 +0100 @@ -54,3 +54,7 @@ 0.17 Sat Aug 27 13:59:31 2011 - fixed non-xs code, #70535 +0.18 Sat Nov 12 23:09:05 2011 + - added convenience wrappers for 'cont', #70672 + - fixed few issues in xs code, #70674 + - added openpgparmor support, #72387 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Digest-CRC-0.17/README new/Digest-CRC-0.18/README --- old/Digest-CRC-0.17/README 2011-08-27 13:59:03.000000000 +0200 +++ new/Digest-CRC-0.18/README 2011-11-12 23:08:26.000000000 +0100 @@ -1,4 +1,4 @@ -Digest::CRC version 0.17 +Digest::CRC version 0.18 ======================== NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Digest-CRC-0.17/lib/Digest/CRC.pm new/Digest-CRC-0.18/lib/Digest/CRC.pm --- old/Digest-CRC-0.17/lib/Digest/CRC.pm 2011-08-27 14:22:37.000000000 +0200 +++ new/Digest-CRC-0.18/lib/Digest/CRC.pm 2011-11-13 00:44:29.000000000 +0100 @@ -8,16 +8,17 @@ @ISA = qw(Exporter); @EXPORT_OK = qw( - crc8 crcccitt crc16 crc32 crc64 crc + crc8 crcccitt crc16 crcopenpgparmor crc32 crc64 crc crc_hex crc_base64 crcccitt_hex crcccitt_base64 crc8_hex crc8_base64 crc16_hex crc16_base64 + crcopenpgparmor_hex crcopenpgparmor_base64 crc32_hex crc32_base64 crc64_hex crc64_base64 ); -$VERSION = '0.17'; +$VERSION = '0.18'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -126,6 +127,7 @@ crc8 => [8,0,0,0,0x07,0,0], crcccitt => [16,0xffff,0,0,0x1021,0,0], crc16 => [16,0,0,1,0x8005,1,0], + crcopenpgparmor => [24,0xB704CE,0,0,0x864CFB,0,0], crc32 => [32,0xffffffff,0xffffffff,1,0x04C11DB7,1,0], ); @@ -167,15 +169,19 @@ ######################################### # Private output converter functions: sub _encode_hex { sprintf "%x", $_[0] } + sub _encode_base64 { - my $res; - while ($_[0] =~ /(.{1,45})/gs) { - $res .= substr pack('u', $1), 1; - chop $res; - } - $res =~ tr|` -_|AA-Za-z0-9+/|;#` - chop $res; chop $res; - $res + my ($res, $padding, $in) = ("", undef, $_[0]); + $in = pack("H*", sprintf("%x",$in)); + while ($in =~ /(.{1,45})/gs) { + $res .= substr pack('u', $1), 1; + chop $res; + } + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3 - length($in) % 3) % 3; + $res =~ s#.{$padding}$#'=' x $padding#e if $padding; + $res =~ s#(.{1,76})#$1\n#g; + $res } ######################################### @@ -258,32 +264,47 @@ _crc($message,$width,$init,$xorout,$refin,$refout,$cont,_tabinit($width,$poly,$refin)); } +sub _cont { + my ($message,$init,@parameters) = @_; + if (defined $init) { + $parameters[1] = $init; + $parameters[6] = 1; + } + crc($message,@parameters); +} + # CRC8 # poly: 07, width: 8, init: 00, revin: no, revout: no, xorout: no -sub crc8 { crc($_[0],@{$_typedef{crc8}}) } +sub crc8 { _cont($_[0],$_[1],@{$_typedef{crc8}}) } # CRC-CCITT standard # poly: 1021, width: 16, init: ffff, refin: no, refout: no, xorout: no -sub crcccitt { crc($_[0],@{$_typedef{crcccitt}}) } +sub crcccitt { _cont($_[0],$_[1],@{$_typedef{crcccitt}}) } # CRC16 # poly: 8005, width: 16, init: 0000, revin: yes, revout: yes, xorout: no -sub crc16 { crc($_[0],@{$_typedef{crc16}}) } +sub crc16 { _cont($_[0],$_[1],@{$_typedef{crc16}}) } + +# CRC-24 for OpenPGP ASCII Armor checksum +# https://tools.ietf.org/html/rfc4880#section-6 +# poly: 0x864CFB, width: 24, init: 0xB704CE, refin: no, refout: no, xorout: no + +sub crcopenpgparmor { crc($_[0],@{$_typedef{crcopenpgparmor}}) } # CRC32 # poly: 04C11DB7, width: 32, init: FFFFFFFF, revin: yes, revout: yes, # xorout: FFFFFFFF # equivalent to: cksum -o3 -sub crc32 { crc($_[0],@{$_typedef{crc32}}) } +sub crc32 { _cont($_[0],$_[1],@{$_typedef{crc32}}) } # CRC64 # special XS implementation (_crc64) -sub crc64 { _crc64($_[0]) } +sub crc64 { _crc64($_[0],$_[1]) } sub crc_hex { _encode_hex &crc } @@ -301,6 +322,10 @@ sub crc16_base64 { _encode_base64 &crc16 } +sub crcopenpgparmor_hex { _encode_hex &crcopenpgparmor } + +sub crcopenpgparmor_base64 { _encode_base64 &crcopenpgparmor } + sub crc32_hex { _encode_hex &crc32 } sub crc32_base64 { _encode_base64 &crc32 } @@ -320,15 +345,22 @@ # Functional style - use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc crc8); + use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc crc8 crcopenpgparmor); $crc = crc64("123456789"); $crc = crc32("123456789"); $crc = crc16("123456789"); $crc = crcccitt("123456789"); $crc = crc8("123456789"); + $crc = crcopenpgparmor("123456789"); $crc = crc($input,$width,$init,$xorout,$refout,$poly,$refin,$cont); + + # add data to existing + + $crc = crc32("ABCD", $crc); + + # OO style use Digest::CRC; @@ -348,7 +380,12 @@ The BDigest::CRC module calculates CRC sums of all sorts. It contains wrapper functions with the correct parameters for CRC-CCITT, -CRC-16, CRC-32 and CRC-64. +CRC-16, CRC-32 and CRC-64, as well as the CRC used in OpenPGP's +ASCII-armored checksum. + +=head1 SEE ALSO + +https://tools.ietf.org/html/rfc4880#section-6 =head1 AUTHOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Digest-CRC-0.17/t/crc.t new/Digest-CRC-0.18/t/crc.t --- old/Digest-CRC-0.17/t/crc.t 2011-08-27 14:24:37.000000000 +0200 +++ new/Digest-CRC-0.18/t/crc.t 2011-11-13 00:33:53.000000000 +0100 @@ -1,5 +1,5 @@ BEGIN { - $tests = 20; + $tests = 21; if ($ENV{'WITH_CRC64'}) { $tests++; } @@ -21,7 +21,7 @@ ENDEV } -use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc8); +use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc8 crcopenpgparmor); ok(1, 'use'); my $input = "123456789"; @@ -53,7 +53,7 @@ $ctx->addfile(F); close(F); my $y = $ctx->digest; -ok($y == 9141249, 'OO crc32 with addfile '.$y); +ok($y == 3613349160, 'OO crc32 with addfile '.$y); # start at offset >0 with previous checksum result $ctx = Digest::CRC->new(type=>"crc32",cont=>1,init=>460478609); @@ -101,3 +101,7 @@ ok($crcccitt == 0x9702, 'crcccitt'); ok($crc16 == 0x0220, 'crc16'); ok($crc8 == 0x82, 'crc8'); + +# openpgparmor +my $openpgparmor = crcopenpgparmor($input); +ok($openpgparmor == 4874579, 'openpgparmor '.$openpgparmor); -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org