We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e5ab8f commit a5f282cCopy full SHA for a5f282c
1 file changed
connect_test.py
@@ -0,0 +1,14 @@
1
+def validateHMAC():
2
+ import hmac
3
+ import hashlib
4
+ import base64
5
+ file = open("payload.txt", "rb") # Read the payload from a file named payload.txt
6
+ payload = file.read()
7
+ secret = "4+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuE=" # Replace this value with your own secret
8
+ signature = "e4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhg=" # Replace this value with your own signature
9
+
10
+ hashBytes = hmac.new(str.encode(secret), msg=payload, digestmod=hashlib.sha256).digest()
11
+ base64Hash = base64.b64encode(hashBytes)
12
+ return hmac.compare_digest(str.encode(signature), base64Hash)
13
14
+print(validateHMAC())
0 commit comments