Bytes message argument error

前端 未结 3 1669
我寻月下人不归
我寻月下人不归 2021-01-18 01:25

I can\'t figure out what the \'bytes\' method is complaining about. In the code below, i am trying to generate an authentication key for my client and i keep getting this er

3条回答
  •  我在风中等你
    2021-01-18 02:12

    try,

    import hmac
    import hashlib
    import base64
    
    message = bytes("Message")
    secret = bytes("secret")
    
    signature = base64.b64encode(hmac.new(secret, message, digestmod=hashlib.sha256).digest())
    print(signature)
    

提交回复
热议问题