讨论,关于怎么理解计算 Internet Checksum

gloomyfish
博客专家认证
2005-12-13 12:28:15
相关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文档中上面的第三点
不要给我贴一堆代码,我也会那样!写出你自己的理解~~~
大家乱谈~~~
...全文
397 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gloomyfish 2005-12-14
  • 打赏
  • 举报
回复
怎么没人回帖,谈谈TCP,IP的checksum目前做法的利弊,怎么在gateway中增量计算
像TTL一样的修改,字节交换的算法,怎么提高改进~~
gloomyfish 2005-12-13
  • 打赏
  • 举报
回复
其他还有人说话吗,楼上的例子好经典~~~
nuaawenlin 2005-12-13
  • 打赏
  • 举报
回复
checksum = 1+2+3=6=0000 0000 0000 0110
checksum = ~checksum = 1111 1111 1111 1001.


接收后校验

checksum = 1111 1111 1111 1001 + 0000 0000 0000 0110 = 1111 1111 1111 1111 = 0

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧