Internet protocol checksum using oneβs complement arithmetic. Sums 16-bit words with end-around carry, then inverts all bits. Used in IP, TCP, UDP, and ICMP headers for packet integrity verification.
| Property | Value |
|---|---|
| Category | Checksums |
| Sub-category | Internet Protocol |
| Security status | π Educational Only |
| Complexity | Beginner |
| Inventor | Internet Protocol designers |
| Year | 1974 |
| Origin | πΊπΈ United States |
| Source | algorithms/checksum/complement.js |
Status: π Educational Only
No vulnerabilities are recorded for this implementation.
3 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β Two 16-bit words 0x0001 + 0x0002, complement 0xFFFC (RFC 1071 section 1 definition)
| Field | Value |
|---|---|
input |
00010002 |
expected |
fffc |
Vector 2 β IP header fragment
| Field | Value |
|---|---|
input |
0001f203f4f5f6f7 |
expected |
220d |
Vector 3 β Single word 0xFFFF, complement 0x0000 (RFC 1071 section 1 definition)
| Field | Value |
|---|---|
input |
ffff |
expected |
0000 |