Constant-time string comparison