in reply to Re^4: CRC of a string
in thread CRC of a string
use strict; # solution: 990644297 my $buffer = "/etc/test2.sh"; my $crc = 0; for (grep $_, split /(.{1,4})/, $buffer) { my $val = sprintf "%02X"x4, map { ord } split //, $_; $crc += hex($val); $crc %= 2**32; } print $crc,$/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: CRC of a string
by ikegami (Patriarch) on Nov 18, 2009 at 18:54 UTC |