18
Example CRC Calculation As was previously shown, flipping the same bits in each byte of a message produces a checksum identical to that of the original message The following example demonstrates that a CRC calculation of those same messages produce a vastly different result Original Message bits = ‘Hi’ = 4869h = 0100 1000 0110 1001 Swapped Message bits = ‘jK’ = 6A4Bh = 0110 1010 0100 1011 *Note: An 8-bit CRC is used in this example for ease of calculation, however 16 and 32-bit CRCs are more useful *Note 2: The XOR gate is located after bit 4 for this example, but this is not always the case. 8-bit CRC hardware diagram

Example CRC Calculation

  • Upload
    clyde

  • View
    54

  • Download
    1

Embed Size (px)

DESCRIPTION

Example CRC Calculation. As was previously shown, flipping the same bits in each byte of a message produces a checksum identical to that of the original message The following example demonstrates that a CRC calculation of those same messages produce a vastly different result - PowerPoint PPT Presentation

Citation preview

Page 1: Example CRC Calculation

Example CRC Calculation As was previously shown, flipping the same bits in each byte of a

message produces a checksum identical to that of the original message

The following example demonstrates that a CRC calculation of those same messages produce a vastly different result

Original Message bits = ‘Hi’ = 4869h = 0100 1000 0110 1001 Swapped Message bits = ‘jK’ = 6A4Bh = 0110 1010 0100 1011

*Note: An 8-bit CRC is used in this example for ease of calculation, however 16 and 32-bit CRCs are more useful

*Note 2: The XOR gate is located after bit 4 for this example, but this is not always the case.

8-bit CRC hardware diagram

Page 2: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

Page 3: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

Page 4: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

Page 5: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

Page 6: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

Page 7: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

Page 8: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

Page 9: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

Page 10: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

Page 11: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

Page 12: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1 Note the effect of the XOR gate on bits 0 and 5

Page 13: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

Page 14: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

000 00010 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

011 00010 0

Page 15: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

000 00010 0

000 00101 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

011 00010 0

110 00101 1

Page 16: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

000 00010 0

000 00101 1

000 01010 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

011 00010 0

110 00101 1

101 01011 0

Page 17: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

000 00010 0

000 00101 1

000 01010 0

000 10100 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

011 00010 0

110 00101 1

101 01011 0

011 10110 1

Page 18: Example CRC Calculation

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00010 0

000 00100 0

000 01001 1

000 10010 0

001 00100 0

010 01000 0

100 10000 0

000 00000 1

000 00001 1

000 00010 0

000 00101 1

000 01010 0

000 10100 0

001 01001 1

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

000 00001 1

000 00011 1

000 00110 0

000 01101 1

000 11010 0

001 10101 1

011 01010 0

110 10100 0

100 01000 1

001 10001 0

011 00010 0

110 00101 1

101 01011 0

011 10110 1

111 01101 1

CRC for ‘Hi’ = 00101001 = 29hCRC for ‘jK’ = 11101101 = EDh

Results: