using System.Security.Cryptography;
public static void Main()
Encoding ascii = Encoding.ASCII;
String fullURL = "https://www.somedomain.com/?parameter1=bob¶meter2=fred&now=2019-12-13T09:50:22Z&sig=vcdf/8wJo4vvLDwdbmxlK4cyLoTyG4sruVp24bzOxEM=";
String fullURLDecode = WebUtility.HtmlDecode(fullURL);
Console.WriteLine(fullURLDecode);
String sentHASH64 = fullURLDecode.Substring(fullURLDecode.LastIndexOf("sig=")+4);
Console.WriteLine(sentHASH64);
String fullQS = fullURLDecode.Substring(fullURLDecode.LastIndexOf("?")+1);
Console.WriteLine(fullQS);
String justparmasQS = fullQS.Substring(0, fullQS.LastIndexOf("sig=")-1);
Console.WriteLine(justparmasQS);
String client_secret = "aSampleSecret";
HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(client_secret));
String calc_sig = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(justparmasQS)));
Console.WriteLine(sentHASH64);
Console.WriteLine(calc_sig);
if (sentHASH64 == calc_sig)
Console.WriteLine("Matches");
Console.WriteLine("Does not match");