C# SHA-1 vs. PHP SHA-1...Different Results?

Solution 1:

Use ASCIIEncoding instead of UnicodeEncoding. PHP uses ASCII charset for hash calculations.

Solution 2:

This method in .NET is equivalent to sha1 in php:

string sha1Hash(string password)
{
    return string.Join("", SHA1CryptoServiceProvider.Create().ComputeHash(Encoding.UTF8.GetBytes(password)).Select(x => x.ToString("x2")));
}