MD5加密

 1 private void buttonX1_Click (object sender, EventArgs e)
 2 {
 3     System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
 4     byte[] data = md5.ComputeHash (System.Text.Encoding.Default.GetBytes (txt_put.Text.Trim() ) );
 5     StringBuilder sb = new StringBuilder();
 6     for (int i = 0; i < data.Length; i++)
 7     {
 8         sb.Append (data[i].ToString ("x2") );
 9     }
10     textBox1.Text = sb.ToString();
11 }

 

posted @ 2016-05-15 22:18  涂山吕吕  阅读(126)  评论(0编辑  收藏  举报