Hmac: various fixes

This commit is contained in:
Théophile Bastian 2018-03-03 13:30:05 +01:00
parent ec1c2508d2
commit 3140339869

View file

@ -82,9 +82,9 @@ def update_repo(hook, clone_url):
def check_signature(received_sig, hook, payload): def check_signature(received_sig, hook, payload):
''' Check Gogs signature ''' ''' Check Gogs signature '''
digest = hmac.new(hook.secret, digest = hmac.new(hook['secret'].encode('utf-8'),
msg=payload, msg=payload,
digestmod=sha256).digest() digestmod=sha256).hexdigest()
return hmac.compare_digest(digest, received_sig) return hmac.compare_digest(digest, received_sig)