Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Comparing checksums of local/remote files.

by ncw (Friar)
on Aug 31, 2000 at 01:00 UTC ( [id://30404]=note: print w/replies, xml ) Need Help??


in reply to Comparing checksums of local/remote files.

cksum is quite good as checksum algorithms go (it uses a 32 bit CRC AFAIK which is good). md5sum is better but you may not have it installed on the machine - if you do then use that for even more feelgood factor.

As for your code - you should check the size of the file too as well as the CRC. The CRC has roughly a 1 chance in 2^32 of failing to detect an error. If you constrain that further by checking the length of the file then you'll add several orders of magnitude to that number (depending on the lengths of your files of course).

# Same to here then my @gg = split /\s+/, $g; my @hh = split /\s+/, $h; die "Files do not match" if $gg[0] != $hh[0] || $gg[1] != $hh[1];
If you could install a module on the far end then I'd install Digest::MD5 and use that. If you can't install any stuff then what you've got looks pretty good to me.

Replies are listed 'Best First'.
RE: Re: Comparing checksums of local/remote files.
by Nooks (Monk) on Aug 31, 2000 at 03:41 UTC
    hydo, I think you should use Digest::MD5 as suggested by ncw---perhaps you can install your perl modules in some area you have write access to, (your home directory, for example) and add that location to @INC?

    If management sees Perl modules at work (more reliable, maintainable, and faster-to-ship code) then they may well decide to do something about the terrible system administration problems you seem to have.

    Good luck!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://30404]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found