c#.net 给一个长度为6的整数密码加密 5
1个回答
展开全部
用MD5、DES啊
比如MD5:
using System.Security.Cryptography;
/// <summary>
/// MD5 加密函数
/// </summary>
/// <param name="str"> </param>
/// <param name="code">16or32 </param>
/// <returns> </returns>
public static string getMD5(string str, int code)
{
if (code == 16) //16位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(8, 16);
}
else if (code == 32) //32位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
}
return "0";
}
比如MD5:
using System.Security.Cryptography;
/// <summary>
/// MD5 加密函数
/// </summary>
/// <param name="str"> </param>
/// <param name="code">16or32 </param>
/// <returns> </returns>
public static string getMD5(string str, int code)
{
if (code == 16) //16位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(8, 16);
}
else if (code == 32) //32位加密
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
}
return "0";
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询