Verify permutation in-place and implement fast power | Tesla