Skip to content

Commit 86cfb67

Browse files
committed
Removed constant_time_compare branch that was only needed for Python 3.2
1 parent d77a662 commit 86cfb67

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

jwt/compat.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def timedelta_total_seconds(delta):
3434
try:
3535
constant_time_compare = hmac.compare_digest
3636
except AttributeError:
37-
# Fallback for Python < 2.7.7 and Python < 3.3
37+
# Fallback for Python < 2.7
3838
def constant_time_compare(val1, val2):
3939
"""
4040
Returns True if the two strings are equal, False otherwise.
@@ -46,12 +46,7 @@ def constant_time_compare(val1, val2):
4646

4747
result = 0
4848

49-
if sys.version_info >= (3, 0, 0):
50-
# Bytes are numbers
51-
for x, y in zip(val1, val2):
52-
result |= x ^ y
53-
else:
54-
for x, y in zip(val1, val2):
55-
result |= ord(x) ^ ord(y)
49+
for x, y in zip(val1, val2):
50+
result |= ord(x) ^ ord(y)
5651

5752
return result == 0

0 commit comments

Comments
 (0)