Checksum family

Internet checksum

The 16-bit ones-complement checksum of IPv4, TCP, UDP and ICMP headers

unverified 1 variant RFC 1071

Overview

The Internet checksum, described in RFC 1071, is the 16-bit ones-complement sum used in IPv4, ICMP, TCP and UDP headers. It is very cheap to compute and to update incrementally when a header field changes. It provides no security against a deliberate attacker.

The data is treated as a sequence of 16-bit words, which are added using ones-complement arithmetic, wrapping any carry from the top bit back into the bottom. The checksum is the ones-complement of the final sum. A receiver sums the data together with the checksum and expects all ones. Because addition is commutative, word order does not matter, which allows routers to update the checksum after changing a field without re-reading the whole header.

NextSSL includes the RFC 1071 Internet checksum as an entry wired from source and not yet verified. It is defined to be computable on 16, 32 or 64-bit words with end-around carry, and network cards often offload it. IPv6 removed the header checksum entirely and relies on link-layer CRCs and upper-layer checksums. None of this provides security: the function has no secret key, and anyone can compute or deliberately collide its outputs.

History

1988–1988
  1. Specified in RFC 1071 Internet checksum

Security notes

The Internet checksum is not cryptographic and offers weak error detection: it cannot detect reordered 16-bit words or many multi-bit errors. Link-layer CRCs and transport security provide the real protection.

Typical uses

IPv4, TCP, UDP and ICMP header checksumsNetwork protocol testing

Variants in NextSSL

1
AlgorithmTierSizes (bytes)StandardsAPI
Internet-Checksum
internet-checksum
unverified out 2 RFC 1071 Internet checksum, NON-cryptographic root

Frequently asked questions

Which Internet checksum variants does NextSSL include?

NextSSL registers 1 Internet checksum variant: internet-checksum.