Question

I'm new to CRCs, boost and more of a java developer for that matter. I'm trying to use the the crc.hpp boost library to create a 6 bit crc calculated based on only two bits. First is this possible?

It seems that the Theoretical CRC Computer can be used to process a specific number of bits, however I'm unclear how to specify a 6 bit result. Help please.

Was it helpful?

Solution

Assuming your input is based on 2 actual bits and not two bytes, this should work:

const int initial_remainder = 0xBAADF00D;

unsigned char input = 0x3;

boost::crc_basic<6> checksum(initial_remainder);
checksum.process_bits(input, 2);

printf("%i", checksum.checksum());

You still need to figure out what the initial remainder should be, though.

OTHER TIPS

This should just be a custom code that maximizes the Hamming distance between four byte values. It would be a table of four 8-bit values indexed by the two bits as a number in 0..3.

A set of values (there 280 such sets) that maximizes the minimum Hamming distance between any two of the four values is: 0x00, 0x4f, 0xb3, 0xfc. The minimum Hamming distance is 5. The high two bits of those values is the two-bit index in order.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top