Calculate Md5 Hash for String - CSharp System.Security.Cryptography

CSharp examples for System.Security.Cryptography:MD5

Description

Calculate Md5 Hash for String

Demo Code


using System.Text;
using System.Security.Cryptography;
using System;/* w  w w .ja  v  a2s  .co  m*/

public class Main{
        public static string CalculateMd5Hash(string val)
        {
            return BitConverter.ToString((new MD5CryptoServiceProvider()).ComputeHash(Encoding.Default.GetBytes(val)));
        }
}

Related Tutorials