I have a simple question about CRC polynomials, and apparently don't understand the canonical sources (found via google). For example, a 16-bit polynomial (x^16 + x^12 + x^5 + 1) has 17 coefficients, but is represented by a 16-bit number by the standard assumption that the highest coefficient is always 1, and then making a bitmap of the other coefficients: 15: 0 14: 0 13: 0 12: 1 11: 0 10: 0 9: 0 8: 0 7: 0 6: 0 5: 1 4: 0 3: 0 2: 0 1: 0 0: 1 This is then "bitreversed" (lowest coefficient is stored in the MSB of the polynomial word): 1000 0100 0000 1000 == 0x8408 Correct? So that, for example, an 8-bit polynomial x^8 + x^4 + x^3 + x^2 + 1 would be represented by: 7: 0 6: 0 5: 0 4: 1 3: 1 2: 1 1: 0 0: 1 and "bitreversed" to 1011 1000 == 0xb8. So, this 8-bit CRC calculation (with crc8 preset of 0xff) would be: #define CRC8_POLY 0xb8 crc8 = 0xff; for (i = 0; i < datasize; i++) { crc8 ^= data[i]; for (j = 0; j < 8; j++) { if (crc8 & 1) crc8 = (crc8 >> 1) ^ CRC8_POLY; else crc8 >>= 1 } } Correct? Thanks! Bill -- Psst... Hey, you... Buddy... Want a kitten? straycatblues.petfinder.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist