You should be using binmode on your input handle.
($check_value & 0x7fffffff) << 1
might be safer (more portable) than
($check_value << 1) & 0xffffffff
The following is faster (but nowhere near as fast as C would be):
$check_value ^= unpack('L', $_); $check_value = ( ($check_value & 0x7fffffff) << 1 ) | ( $check_value >> 31 );
Using C doesn't require shelling out. perlxstut or Inline::C will allow you to access C code from perl.
In reply to Re: Improving performance of checksum calculation
by ikegami
in thread Improving performance of checksum calculation
by Crackers2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |