Function for constant time string comparison.