You can't simply send bytes to JavaScript. You need to convert this to a textual representation for it to be comparable. Hex encoding is supported by both python's hmac module and CryptoJS.
CryptoJS:
CryptoJS.HmacSHA256("test", "secret").toString(CryptoJS.enc.Hex) PythonPython2:
hmac.new("secret", "test", hashlib.sha256).hexdigest() hmac.new("secret", "test", hashlib.sha256).hexdigest() Python3:
hmac.new("secret".encode("utf-8"), "test".encode("utf-8"), hashlib.sha256).hexdigest() Note the difference in the argument ordering.
BothAll produce
0329a06b62cd16b33eb6792be8c60b158d89a2ee3a876fce9a881ebb488c0914