|P is for Practical|
How to use perl digest module to calculate CRC?by guyra (Novice)
|on Mar 20, 2013 at 15:39 UTC||Need Help??|
guyra has asked for the
wisdom of the Perl Monks concerning the following question:
I need to implemenmt CRC-32 (with custom poly) in Perl.
I have seen that there is a module called digest::crc that does it.
However, when I compare the result to an online calculator, I dont get the same CRC code.
My poly is "101101" (bin) or "2d" (hex)
My data is "1e5"
The online calc is:
The result that I get from the calc is "1010" (bin) or "A" (hex)
This is the perl code I used (found somewhere online...):
This is the output of this perl:
CRC for '485' is 0x9d0fec86
I'm pretty sure that the online calculator is correct.
Can someone help me understand what is wrong with my Perl code?