Qt use CRC algo "ISO/IEC 3309" with well-known alias "CRC-16/ISO-HDLC, CRC-16/ISO-IEC-14443-3-B, CRC-16/X-25, CRC-B, X-25", see details. This code to compare Qt's CRC and boost's crc algorithms
#include <QCoreApplication>
#include <boost/crc.hpp>
using namespace boost;
typedef crc_optimal<16, 0x1021, 0xffff, 0xffff, true, true> crc_16_X25;
QString u16Hex(const quint16 value){
return QString("0x"+QString("%1").arg(value, 4, 16, QChar('0')).toUpper());
}
void calc(){
std::array<quint16, 3> arr= {0x0000, 0x0000}; //there is two data elements and third element to keep crc itself
crc_16_X25 crc_boost{};
//crc.reset(); //no need because we calc crc first time; use in case of reuse
crc_boost.process_block(arr.cbegin(), &arr.at(1)); //calc crc of two elements
arr[2]= crc_boost.checksum();
QByteArray b= QByteArray::fromHex("0000");
const quint16 crc_Qt= qChecksum(b);
qDebug() << "Qt" << u16Hex(crc_Qt) << "boost" << u16Hex(arr[2]) ;
}
int main(int argc, char *argv[]){
QCoreApplication a(argc, argv);
calc();
QMetaObject::invokeMethod(&a, "quit", Qt::QueuedConnection);
return a.exec();
}
Output:
Qt "0x0F47" boost "0x0F47"
See how to build boost library for CRC part here