I found an example here on how to hash a string using .NET in which the result is the same output of PHP hashing. But based on the comments, there will be problem if the string is in different encodings. 

Anyways, here is the code. 

 

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;

namespace SimpleWeb.API
{
public class MD5
{
/// <summary>
/// Returns an MD5 has of a string.
/// </summary>
/// <param name="hashMe"></param>
/// <returns></returns>
public string GetHash(string hashMe)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
UTF7Encoding encoder = new UTF7Encoding();
Byte[] encStringBytes;

encStringBytes = encoder.GetBytes(hashMe);
encStringBytes = md5.ComputeHash(encStringBytes);

string strHex = string.Empty;
foreach (byte b in encStringBytes)
{
strHex += String.Format("{0:x2}", b);
}

return strHex;

}
}
}