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());
            }
        }

 

posted @ 2018-10-17 16:33  api-80  阅读(921)  评论(0编辑  收藏  举报