convert To MD5 - CSharp Security

CSharp examples for Security:MD5

Description

convert To MD5

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Security.Cryptography;
using System.Linq;
using System.Collections.Generic;
using System;/*w w  w .j  av a2  s .com*/

public class Main{

        public static string convertToMD5(string str)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            string rs = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(str)));
            rs = rs.Replace("-", "");
            return rs;
        }
}

Related Tutorials