LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC 16 checksum from 1024 bytes

Solved!
Go to solution

Hey,

 

Im trying to calculate the CRC-16 checksum for this old software I got. The software transmits a 512 byte download data block, where every byte is transmitted by 2 ASCII bytes forming the hexadecimal representation of the data byte, so 1024 byte ASCII are transmitted. At the end of every data block there is a checksum calculated and attached to the block as 4 byte ASCII, for example:

 

FFFFFFFFFFFFFFFFFFFFFF.........C00D788F0FAAF A0BA 

 

The checksum is calculated by the use of the software tool. The tool and the software code are quite old, so I have no information about the Tool code or anything else... just this logfile I got from the RS232 sniffer I used....

 

And now I have to check, if the calculated checksum from the program is correct.

 

The only thing I have is the generator polynominal which is x^16+x^11+x^4+1. I used an online calculator and for any reason I got the right checksum with the wrong polynominal (CRC-16-IBM)... I tried changing some of the crc VI's I found here to calculate the right checksum, but neither of them worked... it's been a while since I worked with LabView...

 

So can anyone of you maybe get me some help or give me hints to the solution.... would be really great!!!

 

The used Vi and the Logfile are attached. 

 

Greetings

Chris

Download All
0 Kudos
Message 1 of 9
(5,139 Views)

@chris_492 wrote:

The only thing I have is the generator polynominal which is x^16+x^11+x^4+1. I used an online calculator and for any reason I got the right checksum with the wrong polynominal (CRC-16-IBM)... I tried changing some of the crc VI's I found here to calculate the right checksum, but neither of them worked... it's been a while since I worked with LabView...


The polynomial you gave comes to 0x0811, but the CRC-16-IBM is 0x8005.  And the snippet you gave is using 0x1021.  I'll see if I can find enough time to mess around with the VIs I have to see if I can find the right combination.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(5,128 Views)

https://www.scadacore.com/tools/programming-calculators/online-checksum-calculator/

 

this is the online calculator I used.... and thats where I got the right answer for the CRC-16-IBM lol

 

How do you know the snippet used the 0x1021 polynominal? 🤔

0 Kudos
Message 3 of 9
(5,074 Views)

0xA001 Polynomial with 0x0000 initialisation.

 

Your welcome 😉

 

0xDEAD

0 Kudos
Message 4 of 9
(5,065 Views)

Forgot to attach snippet.

 

CRC CALC.png

 

 

 

0 Kudos
Message 5 of 9
(5,039 Views)

@chris_492 wrote:

How do you know the snippet used the 0x1021 polynominal? 🤔


The constant for the lookup array clearly states "Look-up Table for Poly 0x1021".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 9
(5,035 Views)
Solution
Accepted by topic author chris_492

@deceased wrote:

0xA001 Polynomial with 0x0000 initialisation.


Where did you pull that polynomial from?

 

Anyways, here's the code I put together using that polynomial and it worked.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 7 of 9
(5,028 Views)

I just tried a couple of common ones.

 

This is the reversed IBM-CRC-16

 

No magic I'm afraid

 

0xDEAD

0 Kudos
Message 8 of 9
(5,026 Views)

Here is another version using a Look Up Table. The CRC calculation is a lot faster, however....it's not going to help speeding things up. The conversion from ACSII string to U8 HEX will be the biggest time consumer.

 

CRC16 LUT Version.png

Message 9 of 9
(4,993 Views)