title: How do I create an MD5 hash digest from a text file?
body: <p>Using C#, I want to create an MD5 hash of a text file. How can I accomplish this?</p>
  
  <p><strong>Update:</strong> Thanks to everyone for their help. I've finally settled upon the following code - </p>
  
  <pre><code>// Create an MD5 hash digest of a file
  public string MD5HashFile(string fn)
  {            
      byte[] hash = MD5.Create().ComputeHash(File.ReadAllBytes(fn));
      return BitConverter.ToString(hash).Replace("-", "");            
  }
  </code></pre>