Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re (2): Checksumming dynamically created media (code)

by deprecated (Priest)
on Jul 16, 2001 at 21:15 UTC ( [id://97098]=note: print w/replies, xml ) Need Help??


in reply to Re: Checksumming dynamically created media (code)
in thread Checksumming dynamically created media (code)

This is a great idea.

Can I use seek on a raw device? The problem we run into if we're going to read the whole device, of course, is that the system (burly as it may be) does not have 4.5gb of ram, and 3.5gb of swap is unweildy. So we can't just slurp the whole disk in and checksum it... I was thinking that if we can read in the first gig and the last gig and provide two checksums, we can be reasonably assured that the middle 2.5 gig are okay.

dep.

--
Laziness, Impatience, Hubris, and Generosity.

  • Comment on Re (2): Checksumming dynamically created media (code)

Replies are listed 'Best First'.
Re: Re (2): Checksumming dynamically created media (code)
by bikeNomad (Priest) on Jul 16, 2001 at 21:30 UTC
    Compress::Zlib's crc32 function can update a CRC in pieces; you can call it with an existing CRC to update it. So you read a buffer full at a time and update your CRC:

    use Compress::Zlib my $crc = 0; while ($fh->read($buffer)) { $crc = Compress::Zlib::crc32($buffer, $crc); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-16 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found