c implements the md5 encryption example

  • 2020-06-01 10:51:58
  • OfStack


public static string  EncryptWithMD5(string source)
    {
        byte [] sor=Encoding.UTF8.GetBytes(source);
        MD5 md5=MD5.Create();
        byte [] result= md5.ComputeHash(sor);
        StringBuilder strbul=new StringBuilder(40);
        for(int i=0;i<result.Length;i++)
        {
            strbul.Append(result[i].ToString("x2"));// Encryption result "x2" The results for 32 position ,"x3" The results for 48 position ,"x4" The results for 64 position 

        }
        return strbul.ToString();
    }

Related articles: