.net实现discuz的双重加密
时间:2011-04-21 来源:月井石
/// <summary>
/// 用于Discuz中的用户加密数据
/// </summary>
/// <returns></returns>
public string get_Pwd()
{
sixNum = returnSixNumber();
string md5str = FormsAuthentication.HashPasswordForStoringInConfigFile(this.Register_Password.Value.Trim(), "MD5");
md5str = md5str + sixNum;
string md = FormsAuthentication.HashPasswordForStoringInConfigFile(md5str.ToLower(), "MD5");
return md.ToLower();
}
/// <summary>
/// 返回六位数的随机数
/// </summary>
/// <returns></returns>
public string returnSixNumber()
{
string number = "abcdefghijklmnopqrstuvwxyz0123456789";
string chooseNum = "";
for (int i = 0; i < 6; i++)
{
Random rd = new Random(unchecked((int)DateTime.Now.Ticks));
chooseNum+=number.Substring(rd.Next(1, 38),1);
}
return chooseNum;
}