12 00 00 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 54 e9 7e
С. (с) microchip
// add next character to the crc checksum for ppp packets
unsigned int calc(unsigned int c)
{
char i; // just a loop index
c &= 0xff; // only calculate crc on low byte
for (i=0;i<8;i++) { // loop eight times, once for each bit
if (c&1) { // is bit high?
c /= 2; // position for next bit
c ^= 0x8408; // toggle the feedback bits
} else c /= 2; // just position for next bit
}
return c; // return the 16 bit checksum
}
这段程序是解释红色字节与其它字节间的关系,也可以说是校验码。看不懂,郁闷...