I'm embarrassed to ask, but I've not had any luck yet, so...
I'm writing a checksum routine that adds the 8-bit values of each character in $data. $data contains a binary file of data that was extracted from a database. Ultimately my routine will provide a 2 byte result, i.e. $A24E, that will be stored along with the file in the database.
I've tried the following code...
$checkstart = 0;
$check = 0;
While ($checkstart < strlen($data)) {
$check = $check + intval(substr($data,$checkstart, 1));
$checkstart = $checkstart + 1;
}
But intval doesn't seem to provide the binary value of 0-255 (for an 8 bit character) that I expected.
Any suggestions would be greatly appreciated.
Thanks.