I'm porting some code from PHP to .NET (I'm not a PHP developer) and it all looks pretty straightforward apart from the following line:

```
public function hash($message, $secret)
{
    return base64_encode(hash_hmac('sha1', $message, $secret));
}

```

How can I port this function to .NET?

The base64 encoding is done as follows, but how do I replicate hash\_hmac()?

`Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(tmpString));`

Thanks!