//首先定义一个静态的md5加密方法
public static string getMd5(string str)
{
string pwd="";
Md5 md5= Md5.Create(); //此时需要引用到 Using System.Security.Cryptography
str=DateTime.Now.year+str+DateTime.Now.date //进一步对要加密的字符进行特殊处理;
byte []s=md5.(ComputHash(Encding.UTF8.Getbytes(str))); //其中Encding需要引用到 using System.Text 空间;
for(int i=0; i<s.lenght; i++)
{
pwd=pwd+s[i].ToString();
}
return pwd;
}
//以上代码博友引用时需注意,代码并非从文档中复制过来,需 按照所给步骤一步一步来,且勿一步复制;
//Create 创造的意思; Security 安全,Cryptography 加密;