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?

有帮助吗?

解决方案

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();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top