Finding invertible permutation functions