Example CRC Calculation

Preview:

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

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

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

8-BIT CRC for ‘Hi’ INPUT

000 00000 Init.

000 00000 0

8-BIT CRC for ‘jK’ INPUT

000 00000 Init.

000 00000 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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:

Recommended