Skip to content

Instantly share code, notes, and snippets.

Created January 14, 2022 16:43
What would you like to do?
public string SignURL(string message, string secret)
var encoding = new System.Text.UTF8Encoding();
var keyBytes = encoding.GetBytes(secret);
var messageBytes = encoding.GetBytes(message);
using (var hmacsha1 = new HMACSHA256(keyBytes))
var hashMessage = hmacsha1.ComputeHash(messageBytes);
return Convert.ToBase64String(hashMessage);
public bool SignatureValidation(string query, string secret, string signature)
return SignURL(HttpUtility.UrlDecode(query), secret).ToString().Equals(signature);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment