Simten
Networking~15 nodes•Interactive tutorial • ~8 min read

CRC-32 in Hardware

The 4-byte checksum at the end of every Ethernet frame, ZIP file, and NVMe command, computed by a 32-bit shift register with XOR feedback taps running at line rate in the NIC on your machine right now.

CRC-32 is not magic. It’s a linear feedback shift register: 32 flip-flops in a chain, with certain outputs XOR’d back into the input. The specific XOR positions are defined by the Ethernet polynomial 0x04C11DB7. Every 1-bit in that 32-bit constant is a wire from a flip-flop output back into the chain.

In this post, you’ll build a 4-bit LFSR, understand how the polynomial defines the wiring, and watch the CRC-32 accumulator process bytes one at a time, the same operation your NIC performs at 25 Gbps.