Re: File Hashing



Hi Peter

First of all - thanks for your reply to my question. Much appreciated.

As for your comments on my posting technique:

1) The question is NOT crossposted. It would have been if I posted TWO
seperate messages to which people responded indicidually. But I have posted
ONE message to two different groups and replies from one group will show up
in the other.

2) Are you a programmer at all? How can you reason that a post that's
relevant in a C# group cannot possibly be relevant in a VB.NET group? The
only difference (ok maybe not the only, but the most important difference)
is different syntax. If somebody has a general question about the
functionality of a .NET class then syntax doesn't matter, and a VB.NET
programmer can just as well tell you the correct answer as a C# programmer.

3) To everybody who answered that my first two questions were identical:
They're not - it depends on the answer.

Thanks,
Johnny J.


"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> skrev i meddelandet
news:op.ubvpi7ty8jd0ej@xxxxxxxxxxxxxxxxxxxxxxx
Please do not cross-post between language groups. It's one thing to
"abuse" the C# newsgroup with non-language .NET questions (we all do it
all the time :) ). But if your .NET question is even nominally on-topic
in the C# newsgroup (by virtue of the language you're using), it's
definitely off-topic in the VB.NET newsgroup, and vice a versa.

Follow-ups to m.p.d.l.csharp.

As for the question, you would do well to search this newsgroup for
keywords like "hash", "identical", "file", etc. You'd be amazed at what's
already been said on the topic (especially on your first two questions).

But, the short version is:

On Wed, 28 May 2008 11:44:27 -0700, Johnny Jörgensen <jojo@xxxxxxxxx>
wrote:

I'm wondering (and hoping that somebody will be able to answer this):

If I calculate the hash value of files (either MD5 or SHA1), can I then
be
sure that:

1) Two files with the same hash value are in fact identical?

2) Two different files will NEVER have the same hash value?

Your first two questions are the same, and so the answer for both is the
same: no, you cannot be sure of that.

3) If two files have the same MD5 hash value, they will ALSO have the
same
SHA1 hash value (I should think that will always be the case)?

Granted, I'm not a crypto expert. However, I'd say the answer to this is
also "no". If MD5 provided just as much differentiating power as SHA1,
even though it's 128 bits while SHA1 is 160 bits, then why would anyone
bother with SHA1? No, I think it's safe to say that there are at least
some pairs of files for which the MD5 hash is identical, but the SHA1 hash
is not.

Of course, finding two different files that produce the exact same hash in
either algorithm is either contrived or very difficult. But then, it's
still a possibility (see the answer to questions #1 and #2). :)

Pete


.



Relevant Pages

  • Re: Don Knuth - Uncompressable sequences
    ... reconstruct the original sequence regardless of the length of the ... length (and assuming that the sha1 hash was uniformly distributed), ... sha1 hash, 65536 for a 22 byte file, etc. ... compression algorithm the universe is using that is causing that small ...
    (comp.compression)
  • Re: Anybody home
    ... Hash: SHA1 ... I see very little activity on this newsgroup now. ... 4Q's "wicked evil bitch of satire, parody, humor and trollism" ...
    (alt.comp.anti-virus)
  • Re: Hash order bug?
    ... I first learned about hashes/dictionaries/associative arrays by reading ... that makes immediate sense to the programmer. ... something that's in alphabetical order, ... it goes against the very definition of what a hash is. ...
    (comp.lang.ruby)
  • Re: Don Knuth - Uncompressable sequences
    ... reconstruct the original sequence regardless of the length of the ... Even if you specified the length (and assuming that the sha1 hash was uniformly distributed), you would have 256 possible matches for a 21 byte file with a particular sha1 hash, 65536 for a 22 byte file, etc. ...
    (comp.compression)
  • Re: API to access loaded assembly hash
    ... > same way as the strong name public key used in evidence. ... here is how to get the sha1 hash. ... >>> Dominick Baier - DevelopMentor ...
    (microsoft.public.dotnet.security)