MD5加密

加密密码

 

第一种方法: 添加引用system.web

添加命名空间using System.Web.Security;

string result=FormsAuthentication.HashPasswordForStoringInConfigFile(this.textBox1.Text,"MD5");

第二种方法:添加命名空间using   Sytem.Security.Cryptography;    using   System.Text;

System.Security.Cryptography.MD5 md5=new MD5CryptoServiceProvider();

byte[] old=Encoding.Default.GetBytes(this.textBox2.Text);

byte[] aaa=md5.ComputeHash(old);

string result=BitConverter.ToString(aaa).Replace("-","")

posted @ 2018-11-30 10:07  kuangx  阅读(220)  评论(0编辑  收藏  举报