Calculating a SHA hash with a string + secret key in python

前端 未结 5 614
我在风中等你
我在风中等你 2020-11-30 20:31

Amazon Product API now requires a signature with every request which I\'m trying to generate ushing Python.

The step I get hung up on is this one:

\"Calculat

5条回答
  •  無奈伤痛
    2020-11-30 20:49

    From http://docs.python.org/library/hashlib.html#module-hashlib (modified a bit):

    import hashlib
    secretKey = "1234567890"
    m = hashlib.sha256()
    
    # Get string and put into givenString.
    
    m.update(givenString + secretKey)
    m.digest()
    

提交回复
热议问题