Question

I am struggling with SHA256 encoding.

There is a Python example but I don't understand it quite well. Example (Python):

message = nonce + client_id + api_key
signature = hmac.new(API_SECRET, msg=message, digestmod=hashlib.sha256).hexdigest().upper()

Can somebody make a simple blueprint so I can work from there?

Was it helpful?

Solution

Crypto-js implements SHA256

If you include the library, you should be able to run the following (assuming 'message' and 'API_SECRET' are the same as the python code)

var signature = CryptoJS.HmacSHA256(message,API_SECRET).toString(CryptoJS.enc.Hex).toUpperCase();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top