We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d77a662 commit 86cfb67Copy full SHA for 86cfb67
jwt/compat.py
@@ -34,7 +34,7 @@ def timedelta_total_seconds(delta):
34
try:
35
constant_time_compare = hmac.compare_digest
36
except AttributeError:
37
- # Fallback for Python < 2.7.7 and Python < 3.3
+ # Fallback for Python < 2.7
38
def constant_time_compare(val1, val2):
39
"""
40
Returns True if the two strings are equal, False otherwise.
@@ -46,12 +46,7 @@ def constant_time_compare(val1, val2):
46
47
result = 0
48
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
55
- result |= ord(x) ^ ord(y)
+ for x, y in zip(val1, val2):
+ result |= ord(x) ^ ord(y)
56
57
return result == 0
0 commit comments