Domanda

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?

È stato utile?

Soluzione

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();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top