The project in question is a simple REST interface over HTTPS. I'm trying to hash the data being passed so I can make sure it hasn't been modified during transport (using a salt, of course). However, there seems to be something wrong with my code. The REST server is PHP, and the client is C#.
PHP
public function hash($text)
{
$text = utf8_encode($text);
$encrypted = hash("sha512", $text);
return base64_encode($encrypted);
}
C#
public static string Hash(string Plaintext)
{
byte[] HashValue, MessageBytes = Encoding.UTF8.GetBytes(Plaintext);
SHA512Managed SHhash = new SHA512Managed();
HashValue = SHhash.ComputeHash(MessageBytes);
return Convert.ToBase64String(HashValue);
}
These do not produce the same hash. What am I doing wrong?
As per this edit by the OP, this is the solution: