Internet校验和为校验和添加十六进制数

2024-03-28 10:10:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我遇到了以下创建Internet校验和的示例:

Take the example IP header 45 00 00 54 41 e0 40 00 40 01 00 00 0a 00 00 04 0a 00 00 05:

  1. Adding the fields together yields the two’s complement sum 01 1b 3e.
  2. Then, to convert it to one’s complement, the carry-over bits are added to the first 16-bits: 1b 3e + 01 = 1b 3f.
  3. Finally, the one’s complement of the sum is taken, resulting to the checksum value e4c0.

我想知道如何将IP头添加到一起以获得01 1b 3e?你知道吗


Tags: thetoip示例exampleone校验internet
2条回答

将IP头拆分为16位部分。你知道吗

45 00 
00 54 
41 e0 
40 00 
40 01 
00 00 
0a 00 
00 04 
0a 00 
00 05

总和是01 1b 3e。您可能想看看这里如何计算数据包头校验和https://en.m.wikipedia.org/wiki/IPv4_header_checksum。你知道吗

IP报头与4位十六进制进位数字相加。 i、 e.添加的前3个数字是0x4500+0x0054+0x41e0+。。。你知道吗

相关问题 更多 >