January 5, 2012

goli goli
Ant Farmer
111 posts

qt checksum

 

I’am trying to use the cecksum of QT – qchecksum [doc.qt.nokia.com]
According to the document, this function use CRC-16-CCITT algorithm.
but when I use this function, I don’t get the correct crc.

for example:

  1. char str[]= "123456789";
  2. quint16 qchecksum = qChecksum(str,9);

qchecksum = 0×906E.

but the correct checksum shold be 0×31C3 according to some calculator of checksum and other documents.
does anyone know how to use this function?

[EDIT: fixed link, Volker]

1 reply

January 5, 2012

Volker Volker
Robot Herder
5428 posts

If you look at Appendix A [regregex.bbcmicro.net] of http://regregex.bbcmicro.net/crc-catalogue.htm you can see a map of checksums using various parameters for the CRC algorithms.

0×31C3 is the result of using an initial value of 0×0000, a final XOR with 0×0000, a polynom of 0×1021 and not using reflection – aka XMODEM

0×906E, the Qt result, is for using an initial value of 0xFFFF, a final XOR with 0xFFFF, polynom 0×1021 and using reflection – aka X.25

So, it’s extremely important to use the very same parameters to calculate the checksum.

 
  ‹‹ Infinite QTableView scrolling      Problem with Threading ››

You must log in to post a reply. Not a member yet? Register here!