Convert the weak key and key parity tests to be constant time.