MD5 hashing does not match in C# and PHP

后端 未结 2 1464
一个人的身影
一个人的身影 2020-12-16 10:10

I have tried hashing a string in PHP using MD5 and the same in C#, but the results are different.. can someone explain me how to get this matched?

my C# code looks l

2条回答
  •  清酒与你
    2020-12-16 11:01

    The solution from Juliet didn't give me the same result as a PHP hash I was comparing against (produced by Magento 1.x), however the following did, based on this implementation on github:

                    using (var md5 = MD5.Create())
                    {
                        result = BitConverter.ToString(md5.ComputeHash(Encoding.UTF8.GetBytes(input)))
                            .Replace("-", string.Empty).ToLower();
                    }
    

提交回复
热议问题