C#实例开发之MD5加密实现
今天Xushine研究院又给大家带来新的一个软件开发教程C#实例开发之MD5加密实现~继续说明Xushine研究院的编译环境是Windows 7 x64 Edition + Visual Studio 2010
昨天发了一个随机密码的实现~但是在存储的时候我们一般是MD5加密存储~今天Xushine研究院来实现MD5实现~
首先还是建立一个工程~
还是先拖控件~
开始编写代码~
先引用using System.Security.Cryptography;
点击“MD5加密”按钮,写入按钮事件
private void button1_Click(object sender, EventArgs e)
{
byte[] result = Encoding.Default.GetBytes(this.textBox1.Text.Trim());
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
this.textBox2.Text = BitConverter.ToString(output).Replace("-", "");
}
然后就F5运行吧
呃。。。取下沙发~