This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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