Replace Array.equals to mitigate timing attack