从楼主提问,我才第一次了解MD5,于是百度了一下,在MD5百度百科里,有个叫王小云的教授好像给破解了。
给楼主百度了一个三次加密的算法,看看对楼主有没有帮助
/// <summary>
/// MD5 三次加密算法.计算过程:
/// 1. 验证码转为大写
/// 2. 将密码使用这个方法进行三次加密后,与验证码进行叠加
/// 3. 然后将叠加后的内容再次MD5一下,得到最终验证码的值
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
static string Encypxxx5_3_16(string s)
{
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5CryptoServiceProvider.Create();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(s);
byte[] bytes1 = md5.ComputeHash(bytes);
byte[] bytes2 = md5.ComputeHash(bytes1);
byte[] bytes3 = md5.ComputeHash(bytes2);
System.Text.StringBuilder sb = new StringBuilder();
foreach (var item in bytes3)
{
sb.Append(item.ToString("x").PadLeft(2, '0'));
}
return sb.ToString().ToUpper();
}
/// <summary>
/// 进行MD5加密
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
static string Encypxxx5(string s)
{
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5CryptoServiceProvider.Create();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(s);
byte[] bytes1 = md5.ComputeHash(bytes);
System.Text.StringBuilder sb = new StringBuilder();
foreach (var item in bytes1)
{
sb.Append(item.ToString("x").PadLeft(2, '0'));
}
return sb.ToString().ToUpper();
}
/// <summary>
/// 将验证码和密码进行组合加密,然后重新赋给password
/// </summary>
/// <param name="password"></param>
/// <param name="verifyCode"></param>
/// <returns></returns>
static internal string GetNewPasswordEncypted(string password, string verifyCode)
{
return Encypxxx5(Encypxxx5_3_16(password) + verifyCode.ToUpper());
}