Stack Overflow

2013 年 3 月 5 日3950

I have something like that written in PHP:

$signature = md5($tosigndata);



Now, I am trying to replicate this in C#:

MD5.Create().ComputeHash(Tools.GetBytes(tosigndata))



But that gives me totally different result. How do I need to change my C# code in order to match PHP hash?

PS. Yeah, I know that .ComputeHash() returns byte[], but that doesn't change anything, i tried decoding it and it's still a different string.

Edit: Tools.GetBytes() returns Encoding.UTF8.GetBytes(tosigndata);

0 0