using System.Globalization;
using System.Security.Cryptography;
using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
var tz = DateTime.UtcNow.ToString("yyyyMMdd'T'HHmmss'Z'");
var body = "{\"app\":\"bnk48_member_live\",\"stream\":\"live_dev_3124_1570798291\",\"presets\":[\"copy\"],\"enable_record\":\"hls\",\"input\":\"rtmp\",\"outputs\":[\"hls\"],\"storage\":\"swiftserve_cdn://317/member-live/\",\"hls_encrypt_type\":\"2\",\"hls_key_rid\":\"live-3124\"}";
var txt = new List<string>() { "POST", "/v5.1.0/stream", "20191011T125137Z", "321251", "46eGEv5g8710N9M7", body };
Console.WriteLine("tz: " + tz);
Console.WriteLine(String.Join(@"\n", txt));
Console.WriteLine(HmacSha256Digest(String.Join("\n", txt), "LJ405012o961H361y56r4VW6RhD7389g"));
public static string HmacSha256Digest(string message, string secret)
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] keyBytes = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
System.Security.Cryptography.HMACSHA256 cryptographer = new System.Security.Cryptography.HMACSHA256(keyBytes);
byte[] bytes = cryptographer.ComputeHash(messageBytes);
return BitConverter.ToString(bytes).Replace("-", "").ToLower();