Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt checksum
Qt 6.11 is out! See what's new in the release blog

Qt checksum

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 14.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goli
    wrote on last edited by
    #1

    I'am trying to use the cecksum of QT - "qchecksum":http://doc.qt.nokia.com/4.7-snapshot/qbytearray.html#qChecksum
    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:
    @
    char str[]= "123456789";
    quint16 qchecksum = qChecksum(str,9);
    @

    qchecksum = 0x906E.

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

    [EDIT: fixed link, Volker]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

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

      0x31C3 is the result of using an initial value of 0x0000, a final XOR with 0x0000, a polynom of 0x1021 and not using reflection - aka XMODEM

      0x906E, the Qt result, is for using an initial value of 0xFFFF, a final XOR with 0xFFFF, polynom 0x1021 and using reflection - aka X.25

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

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved