CRC Calculation

I have a sample from 3rd party code which already calculated the checksum. They are using HDLC protocol, I want to figure out how they calculating checksum

Example:

How is msgOut[6] can be calculated automatic or manually
Note: deviceAdress change so it should not be important (I think )

msgOut[0] = 0x7E;
                        msgOut[1] = 0x06;
                        msgOut[2] = deviceAddr;
                        msgOut[3] = 0xBF;
                        msgOut[4] = 0x17;
                        msgOut[5] = cmdCode;
                        if(cmdCode == 0x00)
                            msgOut[6] = 0x7B;
                        else if(cmdCode == 0x04)
                            msgOut[6] = 0x67;
                        else if(cmdCode == 0x11)
                            msgOut[6] = 0x0C;
                        else if(cmdCode == 0x12)
                            msgOut[6] = 0x05;
                        msgOut[7] = 0x7E;
                        rs485WriteHex(msgOut);
                        cmdCode = 0;

Note: deviceAdress change so it should not be important (I think )

Then you think incorrectly.

PaulS:
Then you think incorrectly.

So lets assume device address is 0x11 then how we calculate the CRC

Shahreza:
So lets assume device address is 0x11 then how we calculate the CRC

How would you do it manually ?

UKHeliBob:
How would you do it manually ?

This is 3rd party code, with no description, this is all they gave me. I did some research but I could not get anything similar to this.

http://www.zorc.breitbandkatze.de/crc.html

What is "HLC protocol"?

jremington:
What is “HLC protocol”?

I missed “D” HDLC

http://cpsr.org/prevsite/cpsr/privacy/crypto/tools/other/crc-16-hdlc.c/

also check rfc 1331 RFC 1331 - The Point-to-Point Protocol (PPP) for the Transmissio (RFC1331) -- appendix B

Hi

I am not able to calculate check sum for below massages, I will be appreciated if you can tell how they get this checksum (I even try crc calculator) and how can we write a code for it .

example 1:
Checksum: 30
7E0511BF07307E

example 2:

Checksum 71
7E0611BF1704717E

Thank you

Tool to reverse engineer CRC algorithms, its dead neat:

http://reveng.sourceforge.net/

If it is indeed HDLC protocol, the algorithm has been published in many places.

However, the HDLC CRC check value is 16 bits, not 8 bits.