Signature

How to calculate the signature, if possible in C #?
My calculation is different from Postman’s.
What to put in message?
My code :slight_smile:

    public string CreateToken(string message, string secret)
    {
        secret = secret ?? "";
        var encoding = new System.Text.ASCIIEncoding();
        byte[] keyByte = encoding.GetBytes(secret);
        byte[] messageBytes = encoding.GetBytes(message);
        using (var hmacsha256 = new HMACSHA256(keyByte))
        {
            byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
            return Convert.ToBase64String(hashmessage);
        }

we have a few helper scripts written in different languages, hope it will be helpful. However C# is not included yet, if you still have concern, I would suggest do some research on github, there should have projects implement the signature.
1 Like