问题描述
我在加密中完成如下所示。
plz帮助解密
public void encryptmd5()
{
string source = TextBox5.Text;
使用(MD5 md5Hash = MD5.Create())
{
string hash = GetMd5Hash(md5Hash,source);
TextBox4.Text = hash;
}
}
静态字符串GetMd5Hash(MD5 md5Hash,字符串输入)
{
byte [] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for(int i = 8; i< data.Length; i ++)
{
sBuilder.Append(data [i] .ToString(x2));
}
返回sBuilder.ToString();
}
静态bool VerifyMd5Hash(MD5 md5Hash,字符串输入,字符串哈希)
{
string hashOfInput = GetMd5Hash(md5Hash ,输入);
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
if(0 == comparer.Compare(hashOfInput,hash))
{
返回true;
}
else
{
返回false;
}
}
hi i done in encryption shown below.
plz help decryption
public void encryptmd5()
{
string source =TextBox5.Text;
using (MD5 md5Hash = MD5.Create())
{
string hash = GetMd5Hash(md5Hash, source);
TextBox4.Text = hash;
}
}
static string GetMd5Hash(MD5 md5Hash, string input)
{
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for (int i = 8; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
static bool VerifyMd5Hash(MD5 md5Hash, string input, string hash)
{
string hashOfInput = GetMd5Hash(md5Hash, input);
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
if (0 == comparer.Compare(hashOfInput, hash))
{
return true;
}
else
{
return false;
}
}
推荐答案
这篇关于密码解密在md5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!