I am working to perform CRC32 on some HEX variables.
From the website
http://www.lammertbies.nl/comm/info/crc-calculation.html
CRC32 for 50020301 (input type HEX) is 0xB5E76785
However, when I'm trying to use "hexdigest" apart of Digest::CRC:
my $one = "50020301";
$crc = Digest::CRC->new( type => "crc32" ) ;
$crc->add($one);
my $out=$crc->hexdigest();
print "The checksum of $one is $out \n";
The checksum of 1342309121 is 7a9735d9
It seems like Digest::CRC is doing ASCII CRC32.
I tried setting:
$one = 0x50020301;
But then Digest::CRC interprets that as Dec and converts that to HEX, before continuing ASCII CRC32.
Can someone give me some suggestions on how to do HEX CRC32?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.