16-bit two’s complement checksum. Sums all bytes modulo 65536, then returns two’s complement. Better error detection than 8-bit version for larger data blocks.
| Property | Value |
|---|---|
| Category | Checksums |
| Sub-category | Twos Complement |
| Security status | 🎓 Educational Only |
| Complexity | Beginner |
| Inventor | Unknown |
| Year | 1970 |
| Origin | Not specified |
| Source | algorithms/checksum/complement.js |
Status: 🎓 Educational Only
No vulnerabilities are recorded for this implementation.
2 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 — Byte sum 0x000A, 16-bit complement 0xFFF6
| Field | Value |
|---|---|
input |
01020304 |
expected |
fff6 |
Vector 2 — Byte sum 0x01FE, 16-bit complement 0xFE02
| Field | Value |
|---|---|
input |
ffff |
expected |
fe02 |