C#的MD5加密为什么和JAVA加密出来的结果不一样?
publicstringmd5(stringpassword){MD5md5=newMD5CryptoServiceProvider();byte[]res=md5.Co...
public string md5(string password)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] res = md5.ComputeHash(Encoding.Default.GetBytes(password), 0, password.Length);
StringBuilder builder=new StringBuilder();
foreach(byte b in res){
builder.Append(Convert.ToString(b,16));
}
return builder.ToString();
}
3500000112345620141118050554
JAVA加密结果是:36bd1a4ad036b95e4c4fcf053b8c1de8
C# 加密结果是:36bd1a4ad036b95e4c4fcf53b8c1de8 展开
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] res = md5.ComputeHash(Encoding.Default.GetBytes(password), 0, password.Length);
StringBuilder builder=new StringBuilder();
foreach(byte b in res){
builder.Append(Convert.ToString(b,16));
}
return builder.ToString();
}
3500000112345620141118050554
JAVA加密结果是:36bd1a4ad036b95e4c4fcf053b8c1de8
C# 加密结果是:36bd1a4ad036b95e4c4fcf53b8c1de8 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询