Example UDP Lite Checksum Computation



The following gives example checksum computations for sending `hello world\n' (12 bytes) from one host to another.  The data is as follows:


UDP Lite Pseudo Header (12 bytes):
8b85 ccb7 8b85 ccb0 0088 0014
UDP Lite Header (8 bytes):
8000 04d2 00XX 0000
Payload (12 bytes):
6865 6c6c 6f20 776f 726c 640a


The value in red is variable in the table below. The table gives the computation of checksum values for the above packet as a function of the coverage length. Illegal coverage lengths are marked in red. A checksum coverage of 0 means that the whole packet (20 bytes) is covered.

Checksum coverage
UDP Lite checksum
0
3845
1
CEEF
2
CEEF
3
CAEF
4
CA1D
5
CA1D
6
CA17
7
CA16
8
CA15
9
6214
10
61AE
11
F5AC
12
F53F
13
863E
14
861D
15
0F1C
16
0EAC
17
9CAA
18
9C3D
19
383C
20
3831
21
3830
32768
B844
65535
3845

Since the values in red are illegal (such packets must never be accepted by an end host), they don't mean much and are left here for completeness. In particular, the three last ones simply sum over the packet length, not the coverage length.  There is no change in between 1/2 and 4/5 since the second and fifth octets are zeroes. It is also notable that the theoretical checksums for coverage lengths 0 and 65535 (0xffff) give the same values.

Using bc for these computations can be somewhat tedious, here is a perl script which does the same; configuration values can be edited at the top of the script.