Fletcher is a fast non-cryptographic checksum built from two running sums: sum1 adds each word, sum2 adds each sum1, and the checksum is the two concatenated. Used in TCP , SCTP and OSI IS-IS . Feed it text or raw hex bytes — abcde should give Fletcher-16 0xC8F0 .
(sum2 << 8) | sum1 = (0 × 256) + 0
Folds one byte at a time, modulo 255.
(sum2 << 16) | sum1 = (0 × 65,536) + 0
Folds 16-bit words, modulo 65535.
| Algorithm | Word | Modulus | Initial | Sum1 | Sum2 | Checksum |
|---|---|---|---|---|---|---|
| Fletcher-16 | 8-bit | 255 | 0, 0 | 0 | 0 | 0x0000 |
| Fletcher-32 | 16-bit | 65535 | 0, 0 | 0 | 0 | 0x00000000 |
| Adler-32 | 8-bit | 65521 | 1, 0 | 1 | 0 | 0x00000001 |
Adler-32 uses a prime modulus and starts sum1 at 1, so a run of leading zero bytes still changes its result — Fletcher, starting both sums at 0, does not.
Those are the real checksums of an empty message — both Fletcher sums start at 0, while Adler-32 starts sum1 at 1. Type something to see the trace.
marduc812
© 202620260824_1c411cc