C++ CRC计算输出

C++ CRC计算输出,c++,boost,crc,C++,Boost,Crc,0是循环冗余校验(CRC)的可能校验和吗 我使用boost计算CRC: const unsigned int CrcPolynomial = 0x11021; const unsigned short InitialValue = 0xffff; boost::crc_optimal<16, CrcPolynomial, InitialValue, 0, true, true> Crc; // process some bytes... int x = Crc.checksum();

0是循环冗余校验(CRC)的可能校验和吗

我使用boost计算CRC:

const unsigned int CrcPolynomial = 0x11021;
const unsigned short InitialValue = 0xffff;
boost::crc_optimal<16, CrcPolynomial, InitialValue, 0, true, true> Crc;
// process some bytes...
int x = Crc.checksum(); // <------ can this be 0?
const unsigned int CrcPolynomial=0x11021;
常量无符号短初始值=0xffff;
boost::crc\u最优crc;
//处理一些字节。。。

int x=Crc.checksum();// 对。获取任何消息,
x
,并计算其CRC,
CRC(x)
。然后
crc(x.crc(x))
将为0(其中
表示串联)

事实上,此关系可用于验证消息+CRC是否已正确传输(例如,请参阅第二个动画图表)。

“然后CRC(x.CRC(x))将为0”。这仅适用于基本的CRC算法,没有求反位或反转位。有关更多详细信息,请参阅本文: