def time_independent_HMAC_compare(a, b):
    """
    No-one likes timing attacks.

    This function should probably not be part of the public API, and thus will
    be deprecated in a future release to be replaced with a internal function.
    """
    if len(a) != len(b):
        return False
    result = 0
    a, b = a.lower(), b.lower()
    for x, y in zip(a, b):
        result |= ord(x) ^ ord(y)
    return result == 0
