Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public static string GetMD5Hash(string text)
  2. {
  3.     var md5 = MD5.Create();
  4.     //another way to create and md5 object is new MD5CryptoServiceProvider();
  5.     var stringBuilder = new StringBuilder();
  6.     foreach (var aByte in md5.ComputeHash(GetBytes(text)))
  7.     {
  8.         stringBuilder.AppendFormat("{0:x2}", aByte);
  9.     }
  10.     return stringBuilder.ToString();
  11. }
  12.  
  13.  
  14.  
  15. private static byte[] GetBytes(string text)
  16. {
  17.     return Encoding.UTF8.GetBytes(text);
  18. }