static class StringEx { public static string MD5(this String str) { byte[] bytes = new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(str)); string result = String.Empty; for (int i = 0; i < bytes.Length; i++) { result += bytes[i].ToString("x").PadLeft(2, '0'); } return result; } }