From a841f2b9236540b2ca19fb559f8d410952b37c07 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 15 May 2014 10:26:02 -0400 Subject: Simplify some code that was needlessly complex --- cryptography/hazmat/primitives/twofactor/hotp.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cryptography/hazmat/primitives/twofactor/hotp.py b/cryptography/hazmat/primitives/twofactor/hotp.py index 41c467c8..1a0f4472 100644 --- a/cryptography/hazmat/primitives/twofactor/hotp.py +++ b/cryptography/hazmat/primitives/twofactor/hotp.py @@ -64,8 +64,6 @@ class HOTP(object): ctx.update(struct.pack(">Q", counter)) hmac_value = ctx.finalize() - offset_bits = six.indexbytes(hmac_value, len(hmac_value) - 1) & 0b1111 - - offset = int(offset_bits) + offset = six.indexbytes(hmac_value, len(hmac_value) - 1) & 0b1111 p = hmac_value[offset:offset + 4] return struct.unpack(">I", p)[0] & 0x7fffffff -- cgit v1.2.3