Date : Thu, 11 Nov 2010 09:43:22 +1100
From : awilliams@... (Alan Williams)
Subject: I suspect an error on this
I suspect that this bit
Detokenising byte 0,1,2,3:
lsb : byte 3 EOR (byte 1 * 16)
msb : byte 2 EOR ((byte 1 AND &30) * 4)
has the lsb and msb labels swapped.
I found using the above format lsb+256*msb did not give the right
results, but swapping them round did.
Which for better or worse comes out looking like this in PHP.
echo ((ord($data{$q+3}) ^ ((ord($data{$q+1})*16) & 0xFF))*256 +
(ord($data{$q+2}) ^ (((ord($data{$q+1}) & 0x30) *4)& 0xFF) ));
I added in a couple of '& 0xFF' to ensure the results stayed 8 bits.
Alan