From 1fbd6eb64ea15469489713f7e6a1db450b2beba9 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 29 Dec 2017 12:06:23 -0500 Subject: [PATCH] digest compare in timedHmac --- timedHmac.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/timedHmac.py b/timedHmac.py index a046062d..d703a905 100644 --- a/timedHmac.py +++ b/timedHmac.py @@ -33,7 +33,11 @@ class TimedHMAC: return def check(self, data): + # Check a hash (and verify time is sane) testHash = hmac.HMAC(base64.b64decode(base64Key).decode(), digestmod=self.hashAlgo) testHash.update(data + math.floor(time.time())) testHash = testHash.hexdigest() - if hmac.compare_digest(testHash, self.HMACResult) \ No newline at end of file + if hmac.compare_digest(testHash, self.HMACResult): + return true + else: + return false