Re: Checksums (was Re: Ping, checksum algorithm?)


gordan (att-cb!clyde!watmath!utgpu!utzoo!yunexus!maccs!gordan@ucbvax.Berkeley.EDU)
28 Mar 88 01:33:42 GMT


In article <In article <1080@maccs.UUCP> I wrote:

[A verbose description of one's complement checksums]

Thanks to Mike Brescia, Dave Borman, and Bill Westfield for setting me
straight on this...

Machine byte-order doesn't matter for purposes of doing one's complement
checksums. The quickest way to see this is to note that carries from
the least significant byte get added to the MSB (as in ordinary
addition), and carries from the MSB get added to the LSB (since we add
the hardware carry bit into the sum). Because of this symmetry, the
exact same checksum algorithm can be used on both big-endian and
little-endian machines.

A concise definition of one's complement checksums (from Dave Borman):

-- So how do you calculate the checksum? You add up all the 16 bit
-- words over the data that you want to checksum, and add all the
-- carrys back into the sum. When you are all done, you take the one's
-- complement of the final sum.

-- For outgoing packets, put 0 into the checksum field, calculate the
-- checksum, and fill it in.

-- For incoming packets, the checksum will calculate to 0 if the data
-- is correct.

-- That is it. Sweet and simple.

>From Bob Braden:

-- The TCP/IP checksum properties were discussed early in the TCP/IP
-- development. See "TCP Checksum Function Design", IEN45, by Bill
-- Plummer of BBN; the date was almost 10 years ago-- June 1978.

I suppose the only question I have is whether this document is readily
available... is it part of the standard set of RFCs available from the
DDN NIC?

The corrected checksum info here is posted for the benefit of all the
clueless folks out in bangland (like myself), with apologies to the
the rest of you (I guess this group is top-heavy with gurus).

--
Many Americans work side by side with space
aliens who look	human -- but you can spot
these visitors by looking for certain		    Gordan Palameta
tip-offs, say experts.				    mnetor!maccs!gordan



This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:41:32 GMT