I need to rewrite the code below in c#.
I think the code is written in c but I only understand a few lines.
Can some help me explain the code?
byte crc8(byte *str, int len)
{
int i, f;
byte data;
byte crc;
crc = 0 ;
while (len--)
{
data = *str++;
for = (i = 0; i < 8; i++)
{
f = 1 & (data ^ crc);
crc >>= 1;
data >>= 1 ;
if (f) {
crc ^= 0x8c;
}
}
}
return crc;
}