1

For the Substitution Cipher, for functions such as $$f(x) = x^k \pmod{26}$$ or $$f(x) = x^k + k \pmod{26}$$ (functions that consist of x^k), why do the values of k=5 or k=7 or k > 10 have one-to-one mapping? I know 5 and 7 are relatively prime to 26, however, what about 3 or 9? Also why do it map when k > 10?

DannyNiu
  • 9,207
  • 2
  • 24
  • 57
bjpo027
  • 11
  • 2

2 Answers2

2

The map $x\mapsto x+a ~\pmod n$ is a permutation for any constant $a$.

The map $x\mapsto x^k \pmod n$ is a permutation if and only if )$\gcd(k,\phi(n))=1,$ as pointed out in the other answer.

So $x\mapsto x^k+k\pmod n$ is also a permutation.

kodlu
  • 22,423
  • 2
  • 27
  • 57
1

Unlike $k\cdot x$, $x^k$ works in the multiplicative group rather than additive group.

So (by Fermat's little theorem IIRC) you need to factor 26, subtract 1 from each factors, then multiply them back together (like RSA). which means $k$ must be coprime to 12.

By this logic, 3 and 9 obviously don't work; and it's probably because you've not tried every $k>10$ to determine validity.

kodlu
  • 22,423
  • 2
  • 27
  • 57
DannyNiu
  • 9,207
  • 2
  • 24
  • 57