title: MD5 Hash From String
body: <p>Need to get MD5 hash from string.<br>
  Get an error MD5 is null.<br>
  I am tying to get a 32 character MD5 hash from a string.  </p>
  
  <pre><code>using (System.Security.Cryptography.MD5 md5 = 
         System.Security.Cryptography.MD5.Create("TextToHash"))
  {
      byte[] retVal = md5.Hash;
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i &lt; retVal.Length; i++)
      {
          sb.Append(retVal[i].ToString("x2"));
      }
  }
  </code></pre>