English 中文(简体)
One s complement instead of just a sum of bits
原标题:

A question in my university homework is why use the one s complement instead of just the sum of bits in a TCP checksum. I can t find it in my book and Google isn t helping. Any chance someone can point me in the right direction?

Thanks, Mike

最佳回答

Since this is a homework question, here is a hint:

Suppose you calculated a second checksum over the entire packet, including the first checksum? Is there a mathematical expression which would determine the result?

问题回答

Probably the most important is that it is endian independent.

Little Endian computers store hex numbers with the LSB last (Intel processors for example). Big Endian computers put the LSB first (IBM mainframes for example). When carry is added to the LSB to form the 1 s complement sum) it doesn t matter if we add 03 + 01 or 01 + 03: the result is the same.

Other benefits include the easiness of checking the transmission and the checksum calculation plus a variety of ways to speed up the calculation by updating only IP fields that have changed.

Ref: http://www.netfor2.com/checksum.html





相关问题
Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Math Overflow -- Handling Large Numbers

I am having a problem handling large numbers. I need to calculate the log of a very large number. The number is the product of a series of numbers. For example: log(2x3x66x435x444) though my actual ...

Radial plotting algorithm

I have to write an algorithm in AS3.0 that plots the location of points radially. I d like to input a radius and an angle at which the point should be placed. Obviously I remember from geometry ...

Subsequent weighted algorithm for comparison

I have two rows of numbers ... 1) 2 2 1 0 0 1 2) 1.5 1 0 .5 1 2 Each column is compared to each other. Lower values are better. For example Column 1, row 2 s value (1.5) is more ...

热门标签