I have gone through a few documents to understand how to check that an ethernet frame is valid. I do the following calculation, but I can see it is incorrect because it does not result in a crc value equal to the ones on the ethernet frames.

I know programming questions are off-topic. This question is NOT about programming, it is not even about the CRC-32 algorithm (which I think I have right), but it's about how the ethernetII protocol uses this algorithm. I suspect I miss complementing the bits somewhere, or something like that.

1) I replace the last 4 bytes of the frame (the crc value) by 0

2) I run the calculation over all the frame:

 crc = 0xFFFFFFFF
 for byte between 0 and packetLength :
    nLookupIndex = (crc ^ byte) & 0xFF
    crc = (crc >> 8) ^ crcTable[nLookupIndex]

3) where the crcTable looks like this :

crcTable = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, .... 0x5a05df1b, 0x2d02ef8d]

The resulting crc value I get is wrong. What am I missing?



Browse other questions tagged or ask your own question.