I would like to generate a signature computed in PHP using hmac sha256 algoirthm. The output should be identical to c# as follows:
private static string CreateToken(string message, string secret)
{
var encoding = new System.Text.UTF8Encoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
return BitConverter.ToString(hashmessage);
}
}
Output:
26-FF-E2-E2-95-13-30-4F-96-D4-44-CB-69-21-06-57-B4-E4-4E-83-7B-7C-8E-89-47-C6-67-B3-44-59-4F-18