Re: help with crc32 [SOLVED]

From: Date: Tue, 31 Aug 2004 19:57:18 +0000
Subject: Re: help with crc32 [SOLVED]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195332@lists.php.net to get a copy of this message
I hate when this happens.... all I needed was dechex(). *sigh* I could have sworn I'd tried that already, ah well. Jason Barnett wrote:
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? ?>


« previous php.general (#195332) next »