.net实现discuz的双重加密
/// <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;
}
/// 用于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;
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步