Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import hmac
- def verify(api_key, token, timestamp, signature):
- hmac_digest = hmac.new(key=mailgun_api_key,
- msg='{}{}'.format(timestamp, token).encode('utf-8'),
- digestmod=hashlib.sha256).hexdigest()
- return hmac.compare_digest(signature, hmac_digest)
Add Comment
Please, Sign In to add comment