You should always pay attention to weedpacket's suggestions. Also, it's usually a good idea to mimic the .NET code if you are trying to replicate its functionality:
<?php
$password = "password";
$salt = "123456789";
$result = HashPassword($password, $salt);
echo "result: " . $result . "\n";
if ($result === "woBKg15229VdfiugA/8Dpezf6VAVMu/oKj7fh8H1QDLffHZdSQEsHVz3KHM5phobT3eJSaU7KFbJ6H5KcnDLYw==") {
echo "BINGO. It matches .NET\n";
} else {
echo "Please try again";
}
function HashString($toHash) {
$dataToHash = utf8_encode($toHash);
$hashed = hash("sha512", $dataToHash, TRUE);
return base64_encode($hashed);
}
function HashPassword($password, $salt) {
$combined = $password . $salt;
return HashString($combined);
}
?>
NOTE: I have utf8_encoded $dataToHash in this example but this could produce incorrect results if this string is already utf8 to start with. It sort of depends on where you get $password and $salt from.