Internet-Checksum
The 16-bit ones-complement checksum of IPv4, TCP, UDP and ICMP headers
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Internet-Checksum
Internet-Checksum is a checksum / non-cryptographic hash from the Internet checksum family. It produces a 2-byte (16-bit) output. Its registry entry cites RFC 1071 Internet checksum, NON-cryptographic. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
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–1988Specified 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
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 2 | Output |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
value = root.call("checksum", "internet-checksum", None, b"123456789")[0]
nextssl_root_checksum("internet-checksum", NULL, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_checksum_in(reg::all(), Policy::Any, "internet-checksum", &Params::new())?;
let value = alg.checksum(b"123456789")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
More checksums and non-cryptographic hashes
All 130Frequently asked questions
What is Internet-Checksum?
Internet-Checksum is a checksum in the Internet checksum family. The Internet checksum, described in RFC 1071, is the 16-bit ones-complement sum used in IPv4, ICMP, TCP and UDP headers.
What are the Internet-Checksum sizes?
In NextSSL, Internet-Checksum uses: output 2 bytes.
Who designed Internet-Checksum and when?
Internet-Checksum belongs to the Internet checksum family, first published in 1988. Its origin: RFC 1071.
Which standards define Internet-Checksum?
Internet-Checksum is referenced by RFC 1071 Internet checksum, NON-cryptographic.
Is Internet-Checksum safe to use?
Internet-Checksum is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).