In the tornado.web module there is a function called _time_independent_equals
:
def _time_independent_equals(a, b):
if len(a) != len(b):
return False
result = 0
for x, y in zip(a, b):
result |= ord(x) ^ ord(y)
return result == 0
It is used to compare secure cookie signatures, and thus the name.
But regarding the implementation of this function, is it just a complex way to say a==b
?