aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-05-15 10:26:02 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-05-15 10:26:02 -0400
commita841f2b9236540b2ca19fb559f8d410952b37c07 (patch)
treec7ec3fe651c8c957ac2b7f88ad72892c13949d70
parent22bf924dc123aef0af6fa8a7fc33a4aed72973b9 (diff)
downloadcryptography-a841f2b9236540b2ca19fb559f8d410952b37c07.tar.gz
cryptography-a841f2b9236540b2ca19fb559f8d410952b37c07.tar.bz2
cryptography-a841f2b9236540b2ca19fb559f8d410952b37c07.zip
Simplify some code that was needlessly complex
-rw-r--r--cryptography/hazmat/primitives/twofactor/hotp.py4
1 files changed, 1 insertions, 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