Visual RFC.
ALL RFCs / RFC 1624
Read the RFC ↗
RFC 1624 / INCREMENTAL INTERNET CHECKSUM

Replace one word without scanning every word

02

An updater knows the old checksum, the old 16-bit word and its replacement. It can remove the old contribution, add the new one and complement the resulting sum.

RFC 1624 · § 3EXAMPLE
4 / 4
Replace one word without scanning every wordEquation3 restores old sum from HC0xDD2Fby16-bit complement to0x22D0, adds complement of oldword0x5555which is0xAAAA, obtaining0xCD7A, then adds replacement0x3285toobtain0xFFFF. Final16-bit complement gives0x0000matching full recomputation. Each arrow is arithmetic data flow, not a network packet or an authentication step.Equation 3 · restore, replace, complementupdated sum C′ = 0xFFFF16-bit complementwrite HC′HC′ = ~0xFFFF = 0x0000HC′ = ~(~HC + ~m + m′)
04
Complement the updated sum.

HC′=~0xFFFF=0x0000. This exactly matches recomputing the edited header from scratch.

Source for this drawing: RFC 1624 · Read RFC section 3 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

A message needs an address.

Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

Recover the sum, replace the contribution, then complement once at the end.

  • Equation 3 is HC′ = ~(~HC + ~m + m′), with all complements limited to 16 bits and additions performed using one’s-complement arithmetic.
  • The complement of m represents its additive inverse in that arithmetic. Restore ~HC first; do not move the outer complement through the sum using an ordinary-algebra shortcut.
  • Section 9 recommends either Equation 3 or the equivalent Equation 4, HC′ = HC − ~m − m′, using the specified subtract-with-borrow arithmetic. This walkthrough implements Equation 3, not ordinary machine subtraction.
DETAILS

m is an aligned 16-bit contribution, even when only one byte changes; preserve the other byte. Any protocol-specific checksum coverage and byte order still matter. This bounded update assumes an initially correct checksum and known old/new words; it does not validate a packet or repair unrelated corruption.

Read the RFC section ↗

All chapters in RFC 1624

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗