def ConstTimeCompare(string_a, string_b):
  """Compare the the given strings in constant time."""
  if len(string_a) != len(string_b):
    return False

  equals = 0
  for char_x, char_y in zip(string_a, string_b):
    equals |= ord(char_x) ^ ord(char_y)

  return equals == 0