TIP: Click on subject to list as thread! ANSI
echo: tuxpower
to: Tony Langdon
from: mark lewis
date: 2016-10-01 10:27:34
subject: CRC32

01 Oct 16 22:04, you wrote to Maurice Kinal:

 MK>> The rest looks doable with what I have at hand and strongly suspect
 MK>> that all/most linux distributions also.  I'd imagine the Husky people
 MK>> probably have an agreeable method somewhere in their sources.  Also,
 MK>> also the perl idea looks to be a possibilty but I for one would like
 MK>> to see a oneliner, as well as verification as to compatibilty, before
 MK>> adding that module to the onboard perl here given the limited usuage
 MK>> it will see <- most likely zero.

 TL> I'd br hsppy to use the Perl option, if I could find it for Raspian. :)

as i understand it, Archive::Zip is available... i would expect to find it
on CPAN... from what i understand, it is what brings crc32 to the table...
in fact, i just took a peek at it...

==== Begin "crc32"  ====
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"${at}"}'
    if 0; # not running under some shell

# Computes and prints to stdout the CRC-32 values of the given files

use strict;
use lib qw( blib/lib lib );
use Archive::Zip;
use FileHandle;

my $totalFiles = scalar({at}ARGV);
foreach my $file ({at}ARGV) {
    if ( -d $file ) {
        warn "$0: ${file}: Is a directory\n";
        next;
    }
    my $fh = FileHandle->new();
    if ( !$fh->open( $file, 'r' ) ) {
        warn "$0: $!\n";
        next;
    }
    binmode($fh);
    my $buffer;
    my $bytesRead;
    my $crc = 0;
    while ( $bytesRead = $fh->read( $buffer, 32768 ) ) {
        $crc = Archive::Zip::computeCRC32( $buffer, $crc );
    }
    printf( "%08x", $crc );
    print("\t$file") if ( $totalFiles > 1 );
    print("\n");
}
==== End "crc32" ====

cksum, on the other hand...

cksum: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=7163f0944bd950d5e1ea144aaa1c5be5d3d41d4a, stripped


 MK>> Speaking for myself I'd prefer md5sum for file tranfer verification.
 MK>> From my limited usuage thus far it has proved itself to be an
 MK>> excellent strategy with 100% track record thus far but none of it has
 MK>> anything to do with fidonet and especially not DOS which became
 MK>> abandonware here somewhere around 1995-ish which was one of the
 MK>> samrtest decisions made, next to the idea of, "I don't do
windows."
 MK>> :::evil grin:::

 TL> If it was a simply matter of doing it for my purposes, md5sum would be
 TL> the go, but we have to work with the TIC specs here. ;)

the specs won't be updated until the new feature is in widespread use... i
don't recall if md5 has been seen in any TIC files but the spec should
indicate what to do with unknown options... following existing design, you
could add md5... i would use both for some time until md5 caught on...

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin'
it wrong...
... Not sure where the cow is, but you came to the right place for bull.
---
* Origin: (1:3634/12.73)
SEEN-BY: 18/200 19/33 34/999 90/1 116/18 120/331 123/500 128/187 140/1 218/700
SEEN-BY: 230/150 261/38 100 266/404 267/155 280/464 282/1056 292/907 908
SEEN-BY: 320/119 219 340/400 393/68 396/45 633/267 280 640/384 712/848 770/1
SEEN-BY: 801/189 2320/100 105
@PATH: 3634/12 123/500 261/38 712/848 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.