A checksum is a value computed from packet data used to detect transmission errors. TCP, UDP, and IP headers include checksums. The receiver recomputes the checksum on arrival – if it does not match, the packet is silently discarded. Checksums detect accidental corruption but not malicious tampering (use HMAC for that).
Checksums provide error detection for network protocols. The sender computes a value over the packet data using a simple algorithm (IP uses one's complement sum of 16-bit words) and includes it in the header. The receiver performs the same computation – if the result differs, the packet was corrupted in transit and is dropped. TCP and UDP checksums cover the payload plus a pseudo-header (source/destination IP, protocol, length) to detect misdelivery. IP header checksum covers only the header (it changes at every hop due to TTL decrement, so routers must recompute it). Checksums catch random bit errors from electrical noise, cosmic rays, and faulty hardware. They do not prevent intentional modification – an attacker can recompute the checksum after altering data. For integrity against active attacks, use cryptographic MACs (HMAC-SHA256) or authenticated encryption (AES-GCM).
Packet
A packet is a unit of data transmitted over a network. Each packet contains a header (source/destination addresses, protocol info, sequence numbers) and a payload (the actual data). IP packets are limited by MTU – typically 1500 bytes on Ethernet. Larger messages are split into multiple packets.
CRC (Cyclic Redundancy Check)
CRC is an error-detection code used at Layer 2 to verify frame integrity. Ethernet uses CRC-32 in the Frame Check Sequence (FCS) trailer. CRC detects burst errors up to 32 bits long with 99.99% probability. NICs that receive frames with bad CRC discard them silently – incrementing an interface error counter.