How can I obtain the CRC from a CAN(Controller Area Network) message frame?
<p>I have a project in which I need to create a perl script to parse a .hex file into a .can file full of CAN frames for to be sent. Once the file has been parsed it is going to be read by a C# based GUI that will translate those lines into proper CAN messages to be sent. </p>

<p>The list of aspects that I need to include for the .can is the following:</p>

<ol>
<li><p>Add delays to TX commands</p></li>
<li><p>Add comments that the parser will ignore</p></li>
<li><p>Add a file header comment that the parser will ignore
When file was create, which file, parser version… etc.</p></li>
<li><p>Add a CRC (on the file itself)</p></li>
<li><p>Add an Application CRC (written to certain Flash memory location)</p></li>
</ol>

<p>This is an example of the .hex file that I am parsing:</p>

<pre><code>:020000040000FA
:10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
:10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
:10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
:10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
:10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
:10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
:10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
:10008000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
:10009000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70
</code></pre>

<p>Out of this list I am only missing number 4 and 5. I've been reading about what is CRC and how to make use of it, so I have some knowledge on the topic, but I do not know to implement points 4 and 5. I would appreciate some guidance on how to approach this issue. Below a sample of the .can file that I cam using:</p>

<pre><code>//File used: app1FULL.hex
//Parser version: 0.2 alpha
//Date: Thu Oct 13 16:47:55 2016
TX:10:1537:8:45:EF:0B:F0:FF:FF:FF:FF //load flash
TX:10:1538:8:FA:CF:11:F0:FB:CF:12:F0 //load flash
TX:10:1539:8:E9:CF:13:F0:EA:CF:14:F0 //load flash
TX:10:1540:8:E1:CF:15:F0:E2:CF:16:F0 //load flash
TX:10:1541:8:D9:CF:17:F0:DA:CF:18:F0 //load flash
TX:10:1542:8:F3:CF:19:F0:F4:CF:1A:F0 //load flash
TX:10:1543:8:F6:CF:1B:F0:F7:CF:1C:F0 //load flash
TX:10:1544:8:F8:CF:1D:F0:F5:CF:1E:F0 //load flash
TX:10:1536:5:B:0:16:0:40:00:00:00:00:64 //flash write
RX:1000:1535:3:B:0:16:64 //expect response
PRINT:Boot has failed:Boot received all messages successfully
</code></pre>

<p>Thank you guys! </p>