MD5加密

命名空间

 System.Security.Cryptography

    private string getMd5(string _string)
        {
            MD5 md5 = MD5.Create();
            string rstring = string.Empty;
            byte[] md5b= md5.ComputeHash(Encoding.UTF8.GetBytes(_string));
            foreach (byte b in md5b)
            {
                rstring += b.ToString("X02");
            }
            return rstring;

        }

        private void but_JiaMi_Click(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(Txt_MiWen.Text.Trim()))
            {
              textBox2.Text=getMd5(Txt_MiWen.Text.Trim());
            }
        }
原文地址:https://www.cnblogs.com/apimeng/p/9805020.html