Skip to content
CoreVerified ImplementationLive Benchmarkable

CRC-32 (IEEE 802.3 Checksum)

Computes a 32-bit cyclic redundancy check over a byte stream using GF(2) polynomial division (reflected polynomial 0xEDB88320) to detect accidental data corruption.

Quick Facts

Compact metadata for implementation and discovery.

Category
Compression
Difficulty
Intermediate
Family
Error-Detecting Checksum
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
1
Code example
Ready
Visualization
Ready
Aliases
CRC32, Cyclic Redundancy Check 32

Overview

CRC-32 treats a message as a giant binary polynomial over GF(2) and divides it by the IEEE 802.3 generator polynomial. Using a 256-entry precomputed lookup table processes 8 bits per step in O(n) time, standard across Ethernet, gzip, PNG, and ZIP archives.

Core Concepts

GF(2) polynomial divisionreflected generator 0xEDB88320byte-at-a-time lookup table

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n)

Worst

O(n)

Space

O(1)

Interactive Runtime & Memory Budget Calculator

Estimate wall-clock latency, operation count, and working memory for CRC-32 (IEEE 802.3 Checksum) across input scales.

Input Scale N:
JIT-compiled JS/TS (~350M primitive ops/sec)
Est. Average TimeO(n)

428.6 µs

60 FPS Frame-Safe (<16ms)~150.0k ops
Est. Worst-Case TimeO(n)

428.6 µs

60 FPS Frame-Safe (<16ms)~150.0k ops
Est. Working MemoryO(1)

128 B

L2/L3 Cache FriendlyN=100,000

When to Use

  • IEEE 802.3 32-bit cyclic redundancy check polynomial checksum for fast detection of accidental bit corruption in network frames, Ethernet packets, ZIP archives, and storage blocks.
  • Use CRC-32 to detect accidental transmission or storage corruption in files, packets, and compressed streams.

When Not to Use

  • Never use CRC-32 for security or tamper resistance; CRCs are linear over GF(2) and trivially forgeable (use HMAC-SHA256).

What It Does

  • Precomputes a 256-entry 32-bit remainder lookup table for reflected polynomial 0xEDB88320
  • Processes each byte in O(1) table lookup: crc = table[(crc ^ byte) & 0xFF] ^ (crc >>> 8)

Use Cases

  • Detecting burst bit errors in network frames (Ethernet) and storage blocks
  • Integrity verification in ZIP, gzip, and PNG containers

Inputs

  • Byte buffer (Uint8Array / bytes)

Outputs

  • Unsigned 32-bit IEEE CRC-32 checksum

Key Formulas (1)

CRC Remainder

R(x) = M(x) \cdot x^{32} \bmod G(x)
R(x) = M(x) \cdot x^{32} \bmod G(x)

Polynomial division remainder over GF(2).

Pseudocode

  1. 1.Precompute 256-entry table using reflected generator 0xEDB88320
  2. 2.Initialize crc = 0xFFFFFFFF
  3. 3.For each byte b in data:
  4. 4. crc = TABLE[(crc XOR b) & 0xFF] XOR (crc >>> 8)
  5. 5.Return (crc XOR 0xFFFFFFFF) as unsigned 32-bit integer

Verified Implementation & Unit Tests

Verified Implementation

Tested TypeScript and Python 3 implementations paired with unit tests covering edge cases, duplicate keys, and boundary conditions.

/**
 * CRC-32 Checksum (IEEE 802.3 Polynomial 0xEDB88320) — UTF-8 byte stream + 256-entry lookup table
 */
const CRC32_TABLE = (() => {
  const table = new Uint32Array(256);
  for (let i = 0; i < 256; i++) {
    let c = i;
    for (let k = 0; k < 8; k++) {
      c = (c & 1) !== 0 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
    }
    table[i] = c >>> 0;
  }
  return table;
})();

export function crc32(input: string | Uint8Array): number {
  const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
  let crc = 0xffffffff;
  for (let i = 0; i < bytes.length; i++) {
    const byte = bytes[i];
    crc = CRC32_TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8);
  }
  return (crc ^ 0xffffffff) >>> 0;
}

Canonical Example

Input
ASCII bytes "123456789"
Output
0xCBF43926 (3421780262)
Explanation
Matches the universal ISO-HDLC / IEEE 802.3 CRC-32 check value.

Implementation Notes

  • Verify implementation against the standard check string "123456789" -> 0xCBF43926.

Common Pitfalls

  • Using signed right shift (>>) instead of unsigned right shift (>>>) in JavaScript/TypeScript.
  • Forgetting the initial 0xFFFFFFFF preload or final 0xFFFFFFFF XOR inversion.

Interactive Mechanism Walkthrough & State Debugger

Array Partition & Ordering Trace

Byte-wise shift-register lookup with pre- and post-inversion.

38
[0]
14
[1]
52
[2]
23
[3]
61
[4]
19
[5]
44
[6]
29
[7]
step1 / 5
cursor i0 (val=38)
pivot / key61
sorted prefix0 / 8 items
invariantPartitioning prefix
Step 1 of 5: Precompute 256-entry table using reflected generator 0xEDB88320
array-sort

Notes

Standard IEEE 802.3 check value for ASCII "123456789" is 0xCBF43926.

Sources (1)

What each reference supports for this entry.

RFC 1952 — GZIP file format specification version 4.3 (Section 8: CRC-32)

Documentation

Reference C implementation and polynomial specification for IEEE CRC-32.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Often paired withDeflate

Gzip and PNG pair DEFLATE compression with CRC-32 integrity footers.

Related Algorithms

Tags

ChecksumBitwiseGf2Error Detection