Afficher un message
Vieux 03/04/2007, 16h10   #4
Brad
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: UDP checksum calculation

martinmk's post is incorrect. It simply sums the two 16-bit words.

Oops if I read the title earlier I would have seen that you were
talking about UDP.

UDP's checksum uses the 16-bit one's complement of the one's
complement sum.

In other words, all 16-bit words are summed together using one's
complement:

1110011001100110 and 1101010101010101 (original 16-bit words)

The one's complement of these are:

0001100110011001 and 0010101010101010

Now sum these:

0001100110011001
0010101010101010
----------------------------
0100010001000011 (disregard any carry out of the 16 bits, in this case
there isn't any)

The sum is then one's complemented:

1011101110111100 (This would placed in the checksum field.)

FYI: the checksum that UDP performs is not only done on the UDP header
and data but is a little more complex, see RFC 768 for complete
details.

  Réponse avec citation
 
Page generated in 0,04856 seconds with 9 queries