help with crc32
| From: | Jason Barnett | Date: | Tue, 31 Aug 2004 19:40:21 +0000 |
| Subject: | help with crc32 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-195330@lists.php.net to get a copy of this message | ||
I've been able to use md5 / md5_file to verify file integrity. However when I try to check crc32's I'm running into some problems. As an example I download and extract the PHP package for Windows, then when I try to crc32() the file contents I get a totally different value from what I think I should be getting. Obviously I'm missing out on some crucial detail(s) here...
<?php
echo '<pre>';
// This is the extracted install.txt from PHP-5.0.1.Win32.zip
$file = 'C:\Downloads\install.txt';
// crc for the file - got from my unzip utility
echo $crc = 'EEED9D44' . "\n";
// reading all at once - buffer added line by line produced same results
$contents = file_get_contents($file);
printf ("%u\n", crc32($contents));
// result: 4008549700
// by the way, how can we cast to unsigned integer instead of using printf?
?>