Еще вариант (+)
unsigned char crc8(const void* buf, unsigned char num)
{
unsigned char i;
unsigned char chr, crc = 0;
char* tmp = (char*)buf;
while(num--)
{
chr = *tmp++;
for(i = 0; i < 8; i++)
{
crc = ((chr ^ crc) & 1) ? ((crc ^ 0x18) >> 1) | 0x80 : (crc >> 1) & ~0x80;
chr >>= 1;
}
}
return crc;
}