I need to calculate the CRC

You still aren't answering the question of why you need this?

That is, the normal reason for calculating a crc is to detect transmission errors; but to do that, you need the crc as calculated prior to transmission to compare against. (Or if you are the transmitter; then a full description of the CRC algorithm expected by the receiver.

I'll be more specific: is the CRC algorithm you wish to use 'Rocksoft Model CRC Algorithm'?

If so, the full parameter set for teh algorithm should read something like:

Name : "CRC-32C" Width : 32 Poly : 1EDC6F41 (note that the leading "1" is implied) Init : FFFFFFFF RefIn : True RefOut : True XorOut : FFFFFFFF Check : E3069283
By the way, as far as I understand, the digest::CRC consider the data as an ASCII string. Meaning it takes each char, gets it ascii value, and then convert it to BIN. This is not what I need.

Then you'll need to pre-pack the data before giving it to Digest::CRC.

To do that, you'll need to know whether the CRC should be calculated for the data bytes alone; or should the preceding addresses be included some how?

What format is the data file in? Ie. Where does it come from? What produces it?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: How to use perl digest module to calculate CRC? by BrowserUk
in thread How to use perl digest module to calculate CRC? by guyra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.