title: c# md5 encrypting a string with a key and decrypting
body: <p>I want to encrypt a string value with md5 and then decrypt it so I so that it possible with a key. So I searched how to do this and I found only one other alghorithm.</p>
  
  <p>This is the encryption class:</p>
  
  <pre><code>class crypt
      {
  
          public string encrypt(string bhash)
          {
              MD5 md5 = new MD5CryptoServiceProvider();
              md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(bhash));
              byte[] result = md5.Hash;
              StringBuilder strBuilder = new StringBuilder();
              for (int i = 0; i &lt; result.Length; i++)
              {
                  strBuilder.Append(result[i].ToString("x2"));
              }
              bhash = strBuilder.ToString();
              return bhash;
          }
      }
  </code></pre>