Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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

by deprecated (Priest)
on Jul 16, 2001 at 21:15 UTC ( #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.


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?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2023-06-01 15:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found