02-19-2020 09:21 AM
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
Solved! Go to Solution.
02-19-2020 09:55 AM
@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.
02-20-2020 01:00 AM
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? 🤔
02-20-2020 03:31 AM
0xA001 Polynomial with 0x0000 initialisation.
Your welcome 😉
0xDEAD
02-20-2020 06:45 AM
Forgot to attach snippet.
02-20-2020 06:47 AM
@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".
02-20-2020 07:05 AM - edited 02-20-2020 07:07 AM
@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.
02-20-2020 07:07 AM - edited 02-20-2020 07:09 AM
I just tried a couple of common ones.
This is the reversed IBM-CRC-16
No magic I'm afraid
0xDEAD
02-20-2020 01:17 PM
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.