I need c# equivalent of the below nodejs code. I have some c# code, but the results are not the same.
//working node code below
Ice3x.prototype._signMessage = function (message) {
var hmac = crypto.createHmac('sha512',new Buffer(this.secret, 'base64'));
hmac.update(message);
var signature = hmac.digest('base64');
return signature;
}
//c# code below
public class HmacSignatureCalculator : ICalculteSignature
{
public string Signature(string secret, string value)
{
var secretBytes = Encoding.UTF8.GetBytes(secret);
var valueBytes = Encoding.UTF8.GetBytes(value);
string signature;
using (var hmac = new HMACSHA512(secretBytes))
{
var hash = hmac.ComputeHash(valueBytes);
signature = Convert.ToBase64String(hash);
}
return signature;
}
}