jedikaiti has asked for the wisdom of the Perl Monks concerning the following question:
I am having a bit of a problem with Digest::CRC. I am testing some software handling bad packet headers, and I need to generate CRC8 checksums for a number of packets. However, when I use Digest::CRC to get the checksum for my sanity check packet, I'm not getting what I expect.
According to the best information I have, I should be getting 234 (or EA hex) for the string 7AEE840000187A011B80C001001100119103F3267D000000000000FF00000000. Instead I am getting 236 (or EC hex). Before I go chasing after errors elsewhere, I thought it might be best to run a sanity check past you guys, in case I am doing something wrong in my Perl and not seeing it. I appreciate your help. The code below is what is returning 236/0xEC when I expect 234/0xEA.
#!/usr/bin/perl -w use strict; use warnings; use Math::BaseCnv; use Digest::CRC qw(crcccitt crc crc8 crcopenpgparmor); my $pkt = "7AEE840000187A011B80C001001100119103F3267D000000000000FF000 +00000"; my $crc = crc8($pkt); print "$crc\t". cnv($crc,10,16) ."\n";
Swiss Army Nerd
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Calculating CRC8 using Digest::CRC
by Athanasius (Archbishop) on Jun 07, 2012 at 02:48 UTC | |
by jedikaiti (Hermit) on Jun 07, 2012 at 03:47 UTC | |
by AnomalousMonk (Archbishop) on Jun 07, 2012 at 18:35 UTC | |
by jedikaiti (Hermit) on Jun 07, 2012 at 20:49 UTC | |
Re: Calculating CRC8 using Digest::CRC
by Anonymous Monk on Jun 07, 2012 at 02:55 UTC |