in reply to reproducing javascripts >> operator
The (canonical) way to perform sign extension is via xor and subtract: sub sxtb { (shift ^ 0x80) - 0x80 }
For CRC digest, I'd consider using a specific module, but in a pinch, the following should work:
sub sxt { ((0xffffffff & shift) ^ 0x80000000) - 0x80000000 } ... $crc = ($crc >> 8) ^ ... $crc = sxt $crc; ...
In Section
Seekers of Perl Wisdom