CRC-8 versus a simple checksum — parity and checksum

edge casewhy real protocols use CRC

Answer

F4

Why this example is worth doing

A cyclic redundancy check is polynomial division over GF(2), and its guarantee is categorical: every burst error shorter than the CRC width is detected, which no additive checksum can promise. The page gives the full RevEng parameter set — polynomial, init, reflection in and out, xor-out and the check value — because a bare polynomial is not enough to specify a CRC, and reflection is where hand-rolled implementations go wrong.

Try your own input in the Parity & checksum. Even and odd parity, one’s-complement sums and the Internet checksum, step by step.

How the answer is reached

CRC-8/SMBUS over 9 bytes

CRC-8/SMBUS treats the message as a polynomial over GF(2) and divides it by the generator, keeping the remainder.

Generatorx^8 + x^2 + x + 10x07

The eight parameters of CRC-8/SMBUS. All eight are needed; the polynomial alone is not a specification. — CRC-8/SMBUS over 9 bytes
ParameterValueMeaning
width8register width in bits (degree of the polynomial, less one)
poly0x07generator polynomial, implicit x^width omitted
init0x00register contents before the first message bit
refinfalseeach byte is read MSB-first
refoutfalsethe register is presented as-is
xorout0x00XORed into the register after reflection
check0xF4the published CRC of "123456789"
residue0x00the register after reading a valid codeword

Register at start0x00init

One row per message byte. The register shown is before refout and xorout. — CRC-8/SMBUS over 9 bytes
#ByteBits inRegister after
00x31001100010x97
10x32001100100x72
20x33001100110xC0
30x34001101000xC2
40x35001101010xCB
50x36001101100xFD
60x37001101110x78
70x38001110000xC7
80x39001110010xF4

Register after the message0xF49 bytes read

After refout0xF4refout is false, so nothing changes

CRC0xF4register XOR xorout (0x00)

Warning:

Appending this CRC to the message and re-running leaves the register at the residue 0x00 — that constant is how a receiver checks a frame without recomputing anything.

Source: RevEng CRC catalogue (Rocksoft™ Model CRC Algorithm, Ross Williams 1993)

Compare with

Open the Parity & checksum

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • The parity bit is appended after the data bits, and a checksum is stated with the byte order it was summed in.

Sources

  • Hamming, “Error Detecting and Error Correcting Codes” (1950)
  • Braden, Borman and Partridge, RFC 1071, “Computing the Internet Checksum” (1988)