
Boost Users : 
From: victoriaames (victoriaames_at_[hidden])
Date: 20030709 06:02:20
When I have tried examples using 16 or 32 bit truncated polynomials
this library works perfectly.
Example that works :
unsigned char const data[] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39 };
std::size_t const data_len = sizeof( data ) / sizeof( data[0] );
std::cout << "Expected CRCCCITT : 29B1" << std::endl;
// Simulate CRCCCITT with the optimal version
boost::crc_optimal<16, 0x1021, 0xFFFF, 0, false, false> crc_ccitt2;
crc_ccitt2 = std::for_each( data, data + data_len, crc_ccitt2 );
std::cout << "Optimal CRCCCITT : " << std::hex << crc_ccitt2() <<
std::endl;
However, when I have tried examples using 8 bit truncated
polynomials I fail to get a meaningful checksum.
Example that doesn't work :
std::cout << "Expected CRC8 : EA" << std::endl;
boost::crc_optimal<8, 0x9B, 0, 0, false, false> crc_8;
crc_8 = std::for_each( data, data + data_len, crc_8 );
std::cout << "Optimal CRC8 : " << std::hex << crc_8() << std::endl;
The results I get are :
Expected CRCCCITT : 29B1
Optimal CRCCCITT : 29b1
Expected CRC8 : EA
Optimal CRC8 : Û
Does anyone know why the 8 bit example does not seem to work?
Victoria
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net