CSharp examples for Security:MD5
String Encrypt MD5
using System.Web.Routing; using System.Web.Mvc; using System.Security.Cryptography; using System.Collections.Generic; public class Main{ private static string EncryptMD5(string Value) {//from w ww.ja va2 s. c om System.Security.Cryptography.MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] valueArray = System.Text.Encoding.ASCII.GetBytes(Value); valueArray = md5.ComputeHash(valueArray); string encrypted = ""; for (int i = 0; i < valueArray.Length; i++) encrypted += valueArray[i].ToString("x2").ToLower(); return encrypted; } }