1

I am trying to solve a cryptography-related question, which asks the conditions for an affine cypher's key to be involuntary. This implies $E_k=D_k$, where $E_k$ and $D_k$ are encryption and decryption functions for the involuntary key k over some $ℤ_n$.

This implies that $E_k(E_k(x))=x$, solving which should give us the required conditions. Now, this is where I am confused. The solutions I found online (Q3.b here) solve this as

$E_k(E_k(x))=(a(ax+b)+b) \mod n=x$

Should it not be $(a((ax+b)\mod n)+b)\mod n$.

Why can we ignore the modulo operator on the first time encryption?

Bill Dubuque
  • 272,048

2 Answers2

1

As explained here, in any expression composed of addition and multiplication operations, we obtain an expression $\rm\color{#c00}{congruent}\pmod{\! n}\,$ by inserting or deleting $\color{#0a0}{\bmod} n$ reductions on the results and arguments of these operations. In particular we can delete (erase) all the $\rm\color{#0a0}{mod}$ operations in $\,e(e(x))\,$ to obtain

$$\begin{align} e(e(x)) &= (a(ax\!+\!b\color{#0a0}{\bmod} n)\!+\!b)\color{#0a0}{\bmod} n\\[.3em] &\color{#c00}\equiv\, a(ax\!+\!b)+b \pmod{\!n}\end{align}\qquad$$

Bill Dubuque
  • 272,048
0

All the computations are being done in the same ring $\mathbb Z_n$. As such, in a chain of operations, taking residues can be deferred to the very end – the homomorphism from $\mathbb Z$ to $\mathbb Z_n$ stays intact. You might get larger numbers by not taking modulo in between, but the end result will be the same.

Parcly Taxel
  • 103,344