R
Size: a a a
YY
R
YY
R
R
private static string GetHmacsha256Hash(string key, string message)
{
var keyBytes = Encoding.UTF8.GetBytes(key);
var messageBytes = HexStringToBytes(message);
var hmacsha256Hash = new HMACSHA256(keyBytes).ComputeHash(messageBytes);
return BitConverter.ToString(hmacsha256Hash).Replace("-", "").ToLower();
}
public static byte[] HexStringToBytes(string hex) {
var arr = new byte[hex.Length >> 1];
for (var i = 0; i < hex.Length >> 1; ++i)
{
arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + GetHexVal(hex[(i << 1) + 1]));
}
return arr;
}
public static int GetHexVal(char hex) {
return hex - (hex < 58 ? 48 : hex < 97 ? 55 : 87);
}