Guest User

Untitled

a guest
Dec 13th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import hashlib
  2. import hmac
  3.  
  4.  
  5. def verify(api_key, token, timestamp, signature):
  6. hmac_digest = hmac.new(key=mailgun_api_key,
  7. msg='{}{}'.format(timestamp, token).encode('utf-8'),
  8. digestmod=hashlib.sha256).hexdigest()
  9. return hmac.compare_digest(signature, hmac_digest)
Add Comment
Please, Sign In to add comment