Constant-time string equality
Implement a constant-time string equality check used to compare secrets (tokens, MACs) without leaking timing. Given two strings `a` and `b`, return True if they are equal. Your comparison must not short-circuit on the first differing character; if the lengths differ you may return False immediately (length is not secret here). Do not use Python's built-in `==`, `hmac`, or `secrets` comparison helpers.
Implement
constant_time_equal(a: str, b: str) → boolExamples
in
["abc","abc"]outtrueWhat a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 12 min
solution.py
InputExpectedGot
["abc","abc"]truenot run yetsample