讨论,关于怎么理解计算 Internet Checksum
相关rfc文档:refer to RFC1071
In outline, the Internet checksum algorithm is very simple:
(1) Adjacent octets to be checksummed are paired to form 16-bit
integers, and the 1's complement sum of these 16-bit integers is
formed.
(2) To generate a checksum, the checksum field itself is cleared,
the 16-bit 1's complement sum is computed over the octets
concerned, and the 1's complement of this sum is placed in the
checksum field.
(3) To check a checksum, the 1's complement sum is computed over the
same set of octets, including the checksum field. If the result
is all 1 bits (-0 in 1's complement arithmetic), the check
succeeds.
16的校验和开发当初是为用在PDP-11 16位的机器上,你怎么理解RFC文档中上面的第三点
不要给我贴一堆代码,我也会那样!写出你自己的理解~~~
大家乱谈~~~