用MD5给字符串加密

   private string fun_md5(string str)
   {
        byte[] b = System.Text.Encoding.GetEncoding(1252).GetBytes(str);
        b = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b);
        string ret = "";
        for (int i = 0; i < b.Length; i++)
            ret += b[i].ToString("x").PadLeft(2, '0');
        return ret;
    }

原文地址:https://www.cnblogs.com/lingxzg/p/501658.html