C# winform 中 MD5 加密

来源:互联网 发布:打开vs2012的数据库 编辑:程序博客网 时间:2024/06/05 05:19

转自:http://blog.bc-cn.net/user21/140817/archives/2007/4755.shtm

MD5 md5=new MD5CryptoServiceProvider();
byte[] bt=Encoding.Default.GetBytes("待加密字符串");//将待加密字符转为 字节型数组
byte[] resualt=md5.ComputeHash(bt);//将字节数组转为加密的字节数组
string pwds = BitConverter.ToString(resualt).Replace("-","");//将数字转为string 型去掉内部的无关字符 
 

原创粉丝点击