MD5 Encrypt - CSharp Security

CSharp examples for Security:MD5

Description

MD5 Encrypt

Demo Code


using System.Text;
using System.Security.Cryptography;
using System;/* w w w  .ja  va 2 s  . co  m*/

public class Main{
        public static String Encrypt(String source)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            Byte[] sourceBytes = Encoding.UTF8.GetBytes(source);
            Byte[] outputBytes = md5.ComputeHash(sourceBytes);

            String result = BitConverter.ToString(outputBytes).Replace("-", "");
            return result;
        }
}

Related Tutorials