Am I doing this right. Hashing a text file

From: Anders Jansson (anders.jansson_at_araelektroniks.se)
Date: 05/25/04


Date: Mon, 24 May 2004 15:21:04 -0700

Hi!

Just wanted a confirmation about hashing an entire file correctly.
Does this code really read all bytes from the file while calculating the hash value?

--Code MC++ start

Byte [] HashFile(String fileName)
{
  if (File::Exists(fileName))
  {
      System::IO::FileStream * file = File::OpenRead(fileName);

      // This is one implementation of the abstract class MD5.
      MD5 md5 = new MD5CryptoServiceProvider();

      return = md5.ComputeHash(file);
  }
}
--Code MC++ end

/Thanks



Relevant Pages

  • Re: "index" efficiency... any help or ideas?
    ... no general purpose hashing method, no matter how good, is good enough ... to prevent the possibility that everything hash into the same place. ... > Downside of hashes; if the data is stored externally, ... > perfect hashing are techniques that require analysis of the data in advance, ...
    (alt.lang.asm)
  • Re: A question on an article dealing with pass phrase and keys
    ... In the section Keys vs. Passphrases He mentions using a hashing ... first and it goes through the hash function first. ... Hashing the passphrase to produce a key will not increase ... This can be useful for various crypto applications, ...
    (sci.crypt)
  • Re: "index" efficiency... any help or ideas?
    ... > dealing with different searching algorithms. ... > cons of hashing vs. binary searching. ... That's the killer reason for using hashes in this application. ... Searching a hash table is ...
    (alt.lang.asm)
  • Re: Hashing
    ... using elfhash() for the hash function, and a closed hash table 30,241 in ... tokens, but for a first alpha version system is acceptable. ... However, I've isolated the whole hashing functionality, so that swapping it ... (just a little slow when getting above 20,000+ labels). ...
    (alt.lang.asm)
  • Re: Hashing
    ... I hope people understand that the second hash function is used to ... a variation of the open hashing scheme is fine. ... it takes Otries and space to find a collision for any ... of MD5 collision has been found, and a theoretical weakness has ...
    (alt.lang.asm)