I would suggest you use the secure comparison method available in version 3.3.
This is an implementation that is very similar to the Python implementation:
def compare_digest(x, y): if not (isinstance(x, bytes) and isinstance(y, bytes)): raise TypeError("both inputs should be instances of bytes") if len(x) != len(y): return False result = 0 for a, b in zip(x, y): result |= a ^ b return result == 0
It is impossible to see how this violates any licenses.
source share