创建一个MD5加密字符类

 //创建一个MD5加密字符类

View Code
//MD5
public class DESEncrypt
{      
public static string Encrypt(string strText)
{
      byte [] data=System.Text.Encoding.Unicode.GetBytes (strText.toCharArray());
System.Security.Cryptography.MD5 MD5=NEW System.Security.CryptoServiceProvider();
byte [] result=MD5.ComputeHash(data);
string sResult=System.Text.Encoding.Uncode.Getstring(result);
string EnPwd=System.Web.Security.FromAuthentication.HashpasswrodForStoring InConfig(strText.ToString(),"MD5");
RETURN EnPwd;
}
 }

 


 

posted @ 2012-11-07 11:13  Mark1997  阅读(463)  评论(0编辑  收藏  举报