Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
None
-
4.5.3
-
None
Description
In the three sentences that describe qChecksum() the algorithm that this function implements is variously described as "CRC-16" and "CRC-16-CCITT". However, the output from it fails to conform to the output of geenrators for CRC-16, or any of the three CRC-16-CCITT algorithms for which I have generators (0x0000, 0xFFFF, 0x1D0F).
Attached is a file for which I want to generate a CRC-16 checksum. It is a binary file, read into a QByteArray from a QFile in its entirety. The size of the QByteArray is 0x20000, which exactly matches he size of the file on disk, which indicates that the QByteArray is not including a terminating '\0' character. The code snippet is:
quint16 GetCRC(const QByteArray & filestream) { return qChecksum(filestream, filestream.size()) }
The qChecksum call returns 0x2BBD. My generators (which have been verified by two different programs, all of which return the same result) show:
- CRC-16: 0xDDBD (this is the desired result)
- CRC-16-CCITT(0x0000): 0x07BF
- CRC-16-CCITT(0xFFFF): 0x837F
- CRC-16-CCITT(0x1D0F): 0x09AF