互联网校验和——将十六进制数加在一起作为校验和
Internet checksum -- Adding hex numbers together for checksum
我遇到了以下创建 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
:
- Adding the fields together yields the two’s complement sum
01 1b 3e
.
- Then, to convert it to one’s complement, the carry-over bits are added to the first 16-bits:
1b 3e + 01 = 1b 3f
.
- Finally, the one’s complement of the sum is taken, resulting to the checksum value
e4c0
.
我想知道IP头是怎么加在一起得到01 1b 3e
的?
IP头加4位十六进制数进位。
即添加的前 3 个数字是 0x4500 + 0x0054 + 0x41e0 +...
将您的 IP header 拆分为 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 查看数据包 header 校验和的计算方式。
我遇到了以下创建 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
:
- Adding the fields together yields the two’s complement sum
01 1b 3e
.- Then, to convert it to one’s complement, the carry-over bits are added to the first 16-bits:
1b 3e + 01 = 1b 3f
.- Finally, the one’s complement of the sum is taken, resulting to the checksum value
e4c0
.
我想知道IP头是怎么加在一起得到01 1b 3e
的?
IP头加4位十六进制数进位。 即添加的前 3 个数字是 0x4500 + 0x0054 + 0x41e0 +...
将您的 IP header 拆分为 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 查看数据包 header 校验和的计算方式。