crc32
| From: | Wojtek Meler | Date: | Mon, 05 Sep 2005 11:08:40 +0000 |
| Subject: | crc32 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-18675@lists.php.net to get a copy of this message | ||
I've patched original crc32 PHP function to allow incremental crc32 counting.
It touches only a few lines of original code.
New crc32 function signature is
int crc32(string str [,int prev_sum])
With this patch you can generate crc32 checksum for even large files without reading it contents to single variable.
Fe. instead of doing
| $file_string = file_get_contents($file);
$crc = crc32($file_string); |
you can do
$crc=0;
$f =fopen($file,'r');
while ( $data=fread($f,1024)) $crc = crc32($data,$crc);
fclose($f);
Icremental processing has less memory requirements.
I'd like also change base64_* functions to allow incremental processing.
Any chances apply such changes ?
Regards,
Wojtek