file checksum?
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Tue Oct 1 18:13:45 UTC 2013
| From: William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>
| I would like to do some kind of "checksum" on files (full or partial
| content) in order to catch unwanted changes (accidental or malicious).
| How would you do it?
I would not use CRC these days. I did 30 years ago:
<https://groups.google.com/forum/#!msg/net.sources/4ERvPT6oxdA/nY6T761u2h0J>
This was originally for checking file transfers between my Altair and
Kaypro computers and UNIX systems via phone lines.
See this thread for more file hashing discusion from this list:
<http://thread.gmane.org/gmane.org.user-groups.linux.tolug/61358>
| Is there user-callable CRC routines in glibc? Curiously, I can't find
| one, even though I'm told that TCP stack uses it internally.
TCP itself uses a plain sum:
The checksum field is the 16 bit one's complement of the one's
complement sum of all 16 bit words in the header and text. If a
segment contains an odd number of header and text octets to be
checksummed, the last octet is padded on the right with zeros to
form a 16 bit word for checksum purposes. The pad is not
transmitted as part of the segment. While computing the checksum,
the checksum field itself is replaced with zeros.
The use of "one's complement" is a bit confusing since I would
consider the values unsigned. I think that they just mean "all bits
flipped" when they say "one's complement".
I think that ethernet uses CRC32.
I don't know about TCP in general, but the PPP RFCs seem to have used
my code.
<http://www.ietf.org/rfc/rfc1331.txt>
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list