import secrets


def constant_time_compare(val1, val2):
    """Return True if the two strings are equal, False otherwise."""

    return secrets.compare_digest(
        bytes(val1, encoding="utf-8"), bytes(val2, encoding="utf-8")
    )