One's complement sum of 16-bit words: the carry that leaves on the left wraps around and is added on the right; at the end every bit is inverted. Then the receiver checks it, also through a channel that flips bits.
An animated calculator of the UDP checksum (Kurose and Ross §3.3.2, RFC 768 and RFC 1071) without the pseudo-header. Between 2 and 6 16-bit words, editable in hexadecimal, in binary or bit by bit, are summed two at a time in one's complement, column by column or one sum at a time, with the internal carries visible; the carry that leaves on the left (the 17th bit) wraps around and is added to the least significant bit, and at the end every bit is inverted to obtain the checksum. A switch adds a zero padding byte when the number of bytes is odd, which takes part in the sum but is not transmitted. The receiver checks the segment in two equivalent ways: summing every word including the checksum (with no error the result is FFFF) or setting the field to 0, recomputing and comparing. A channel with errors lets you flip bits of the received words: a one-bit error is always detected, whereas two bits that cancel out in the same column go undetected, which is why the link layer adds a CRC. It includes the book example, random words and a practice mode in which the checksum is typed in hexadecimal.
Concepts: UDP checksum, one's complement sum, end-around carry, one's complement, 16-bit words, padding byte, receiver verification, end-to-end error detection, undetected errors, CRC.
Formulas:
sum = Σ words in one's complement (the carry out of bit 16 is added to bit 0)checksum = ~sum (all 16 bits inverted)receiver: Σ words + checksum = FFFF if no error is detectedNetwork Architecture I, Session 3.1 · Enrique de la Hoz, University of Alcalá · License CC BY-SA 4.0 · Source and catalogue on GitHub · DOI 10.5281/zenodo.23285664