# two's compliment
substr($bytes, 0, 1, chr(ord(substr($bytes, 0, 1)) - 1));
$bytes = join('', map { chr(~ord($_) & 0xff) } split(//, $bytes));
# two's compliment
substr($bytes, 0, 1, chr(ord(substr($bytes, 0, 1)) - 1));
$bytes = join('', map { chr(~ord($_) & 0xff) } split(//, $bytes));