wire / wire-format / crc
CRC is an error-detecting code based on polynomial division. Data is treated as a polynomial; divided by a generator polynomial; remainder is the CRC. Common CRCs: CRC-8 (0x07), CRC-16-CCITT (0x1021), CRC-32 (0x04C11DB7, used in Ethernet, ZIP, PNG), CRC-64 (0x000000000000001B). Properties: detects all single-bit errors, all double-bit errors (for CRC width ≥ 2), all odd-bit errors (if generator has factor x+1), burst errors up to width bits.
aka: CRC (Cyclic Redundancy Check)
spec: CRC (Peterson, 1961)
CRC is an error-detecting code based on polynomial division. Data is treated as a polynomial; divided by a generator polynomial; remainder is the CRC. Common CRCs: CRC-8 (0x07), CRC-16-CCITT (0x1021), CRC-32 (0x04C11DB7, used in Ethernet, ZIP, PNG), CRC-64 (0x000000000000001B). Properties: detects all single-bit errors, all double-bit errors (for CRC width ≥ 2), all odd-bit errors (if generator has factor x+1), burst errors up to width bits.
| field | size | meaning |
|---|---|---|
| Generator polynomial | degree+1 bits | The divisor polynomial. E.g., CRC-32: x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 (0x04C11DB7). |
| CRC computation | O(n) with lookup table | Process data byte by byte. For each byte, XOR with CRC register, look up in table, shift. O(n) with table, O(n*w) without. |
| CRC-32 | 4 bytes | Polynomial 0x04C11DB7. Used in Ethernet (FCS), ZIP, PNG, gzip, and many other formats. |
| CRC-16-CCITT | 2 bytes | Polynomial 0x1021. Used in X.25, HDLC, and many telecom protocols. |
| CRC-8 | 1 byte | Polynomial 0x07. Used in SMBus, I2C, and small packets. |
| Detection capability | properties | Detects: all single-bit errors, all double-bit errors (width ≥ 2), all odd-bit errors (if gen has x+1 factor), burst errors ≤ width bits. |
example:
00 00 00 00
CRC (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/crc
or /wire-format/crc.json