Thank you very much for your great answers. So I could learn a lot.
Here the final solution:
#!/usr/bin/perl use strict; use warnings; my $str = "/etc/test2.sh"; # checksum32: 990644297 my $checksum32 = &calcChecksum32($str); print $checksum32 . "\n"; sub calcChecksum32() { my $str = $_[0]; my $nb_pad_bytes = 4 - (length($str) % 4); $str .= "\0" x $nb_pad_bytes; unpack('%32N*', $str); }
In reply to Re^4: CRC of a string
by Dirk80
in thread CRC of a string
by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |