0

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?

DevShark
  • 175
  • 1
  • 7
  • https://networkengineering.stackexchange.com/questions/45352/calculate-the-fcs-number-from-a-frame-ethernet – manish ma Jan 26 '20 at 14:21
  • The program bit simply does not look correct. The formula is in the answer to the question linked in the comment above. – Ron Maupin Jan 26 '20 at 15:28
  • Ah really ? That’s what I saw on the wikipedia page : https://en.m.wikipedia.org/wiki/Cyclic_redundancy_check#CRC-32_algorithm – DevShark Jan 26 '20 at 15:31
  • Well, there are questions with answers about this on [so]. For example, [this one](https://stackoverflow.com/q/9286631/3745413). In any case, this is not really something network engineers do. Mostly the FCS calculation and verification are done in hardware. – Ron Maupin Jan 26 '20 at 15:53
  • Understood, thank you. I will look into these. – DevShark Jan 26 '20 at 17:18

0 Answers0