Implement a timing-safe string comparison to prevent side-channel attacks.
Constraints
Example
>>> constant_time_compare("abc", "abc")
True
>>> constant_time_compare("abc", "abd")
False
>>> constant_time_compare("abc", "abcd")
False
>>> constant_time_compare("", "")
True
>>> constant_time_compare("a", "b")
False
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints