simplify isPermutationHash