Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Dec 2001 21:01:32 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        <sysop_blast@hotmail.com>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: From M. Callihan
Message-ID:  <20011227205415.N21746-100000@catalyst.sasknow.net>
In-Reply-To: <DURONKum3v7RlySvTD800000162@HIVAIDSsearch.com>

next in thread | previous in thread | raw e-mail | index | archive | help
sysop_blast@hotmail.com wrote to freebsd-questions@FreeBSD.ORG:

> M. Callihan says:
>
> I have found that once a given file becomes corrupted md5 will
> give a different checksum on that file each time it is ran against
> it.

Unless I'm reading you wrong, I think you have misunderstood MD5.

The MD5 algorithm is designed to always return the same message
digest, given the same input.

So, if the input (file) changes, the MD5 digest will change as well.

If the input file does not change, the MD5 digest will be the same.

If the input file becomes corrupted, the MD5 digest will be different
than the digest for the un-corrupted version. But calculating MD5
again on the *same* corrupted version will produce the *same*
incorrect checksum.

In other words, MD5 has no concept of "corruption". It reads bits and
calculates a checksum based on the input it observes. If the bits are
the same, the checksum will be the same. If the bits are different,
the checksum will (almost certainly) be different.

Try it...

echo foo > bar
md5 bar
echo led >>bar
md5 bar
md5 bar  (twice.. notice same checksum both times)

Clear?

- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011227205415.N21746-100000>