string,butresultisdifferent...有人能解释一下如何使它匹配吗?我的C#代码看起来像md5=newMD5CryptoServiceProvider();originalBytes=ASCIIEncoding.Default.GetBytes(AuthCode);encodedBytes=md5.ComputeHash(originalBytes);Guidr=newGuid(encodedBytes);stringhashString=r.ToString("N");在此先感谢编辑:我的字符串是123字符串输出;PHP:202cb962ac59075b964b07152d234b70C#:62b92c2059ac5b07964b07152d234b70你的问题在这里:Guidr=newGuid(encodedBytes);N");我不确定为什么要将编码字节加载到Guid中,但这不是将字节转换回字符串的正确方法。UseBitConverterinstead:以上是C#学习教程:MD5哈希不匹配C#和PHP中共享的全部内容。如果对大家有用,需要详细了解C#学习教程,希望大家多多关注——stringtestString="123";byte[]asciiBytes=ASCIIEncoding.ASCII.GetBytes(testString);byte[]hashedBytes=MD5CryptoServiceProvider.Create().ComputeHash(asciiBytes);字符串hashedString=BitConverter.ToString(hashedBytes).Replace("-","").ToLower();//hashString==202cb962ac59075b964b07152d234b70本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
