in reply to Re: CRC-16 algorithm
in thread CRC-16 algorithm
Thanks! OK, got it and tried it. The documentation is a bit sparse, but using String::CRC gives rise to a program like so:
use strict; use warnings; use String::CRC; my $message = $ARGV[0]; my $crc16 = crc($message); print "CRC16 in decimal: $crc16\n"; print "CRC16 in hex:\n ", unpack('H*', pack('S', $crc16)), "\n";
Running the program gives this output:
cradcliff% ./crc16-modular.pl foo CRC16 in decimal: 1736882148 CRC16 in hex: b7e4 cradcliff% ./crc16-modular.pl foobar CRC16 in decimal: 3375757715 CRC16 in hex: f993 cradcliff% ./crc16-modular.pl foobaz CRC16 in decimal: 3375757723 CRC16 in hex: f99b
More simply:
'foo' => 0xb7e4 'foobar' => 0xf993 'foobaz' => 0xf99b
Can anyone verify that these are correct values for a CRC-16 checksum, assuming the conditions I specified earlier? Alternately, can anyone supply sample string-checksum pairs I can use to test this program?
Thanks, ~c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (String::CRC) Re: CRC-16 algorithm
by PodMaster (Abbot) on May 21, 2003 at 07:02 UTC | |
by CMonster (Scribe) on May 21, 2003 at 17:28 UTC | |
by Anonymous Monk on Feb 23, 2015 at 11:38 UTC | |
by Anonymous Monk on Feb 23, 2015 at 12:23 UTC | |
by Anonymous Monk on Feb 23, 2015 at 20:26 UTC |