Date: Wed, 1 May 1996 14:54:46 +0200 (MET DST) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: hackers@freebsd.org Subject: Fast IP/TCP checksums ? Message-ID: <199605011254.OAA08931@labinfo.iet.unipi.it>
next in thread | raw e-mail | index | archive | help
Hi, I was looking at TCP/IP checksums recently. Can someone explain why IP/TCP checksums can be computed using the same algorithm on both big-endian and little-endian systems, yet produce the same result (after a final ntohs() of course) ? It surely has to do with the fact that the representations of 0 in 1's complement have the same low & high bytes, but I haven't been able to find a formal proof of why it works. Besides (hence the Subject for this message) it appears that you can compute checksums using 32-bit sums and yet produce the same result! This could save something in the computation of checksums, as you need half as many adds, and much less data movements as all operands are 32-bit aligned. Luigi ==================================================================== Luigi Rizzo Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it Universita' di Pisa tel: +39-50-568533 via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 http://www.iet.unipi.it/~luigi/ ====================================================================
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605011254.OAA08931>