For some reason, Chris01234 seems resolutely committed to byte-by-byte access to the data block, but if you're going to use a block-by-block approach, why not just
$check_sum += unpack('%16C*', $buff);
(see unpack) and then bitwise-and mask to 16 bits before returning? (I'd also use the biggest buffer I could get away with. 10MB? 100MB?)
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Accessing individual bytes of a binary file as numerical values
by AnomalousMonk
in thread Accessing individual bytes of a binary file as numerical values
by Chris01234
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |