Affine Matrix Cryptosystem

Assume the letters A-Z are labeled by 0, … , 25 and the blank is labeled by 26, i.e. the alphabet with a blank is identified with the ring \mathbb{Z}/27\mathbb{Z}. We define the key of an affine matrix cryptosystem to be (A,B), where A\in M_2(\mathbb{Z}/27\mathbb{Z})^\times and b \in \mathbb{Z}/27\mathbb{Z}^2, which defines an enciphering transformation

    \begin{align*} f_{A,B}: \mathbb{Z}/27\mathbb{Z}^2 &\rightarrow \mathbb{Z}/27\mathbb{Z}^2 \\ x &\mapsto Ax+B \end{align*}

Example 1: Encipher the message “WELCOME TO THE NEW AGE” using an affine cryptosystem with the key (A,B), where

    \[A=\begin{pmatrix} 5 & 4 \\ 2 & 2 \end{pmatrix} \text{ and } B=\begin{pmatrix} 3 \\ 2 \end{pmatrix}\]



Step 1: Translate the message to the labeling in \mathbb{Z}/27\mathbb{Z} in matrix form:

\text{``WELCOME TO THE NEW AGE''}
\Downarrow
``\left(\begin{array}{ccccccccccc} 22 & 11 & 14 & 4 & 19 & 26 & 7 & 26 & 4 & 26 & 6 \\ 4 & 2 & 12 & 26 & 14 & 19 & 4 & 13 & 22 & 0 & 4\end{array}\right)''

Step 2: Apply the encipher transformation:

\begin{pmatrix} 5 & 4 \\ 2 & 2 \end{pmatrix}\left(\begin{array}{ccccccccccc} 22 & 11 & 14 & 4 & 19 & 26 & 7 & 26 & 4 & 26 & 6 \\ 4 & 2 & 12 & 26 & 14 & 19 & 4 & 13 & 22 & 0 & 4\end{array}\right) +\left(\begin{array}{ccccccccccc}3 & 3 &3 &3 &3 &3 &3 &3 &3 &3 &3 \\ 2  & 2 &2 &2 &2 &2 &2 &2 &2 &2 &2\end{array}\right)
=\left(\begin{array}{ccccccccccc} 129 & 66 & 121 & 127 & 154& 209 & 54 & 185 & 111 & 133 & 49 \\ 54 & 28 & 54 & 62 & 68 & 92 & 24 & 80 &54 &54 & 22\end{array}\right)
\equiv\left(\begin{array}{ccccccccccc} 21 & 12 & 13 & 19 & 19& 20 & 0 & 23 & 3 & 25 & 22 \\ 0 & 1 & 0 & 8 & 14 & 11 & 24 & 26 &0 &0 & 22\end{array}\right)

Step 3: Translate the message back to the alphabet from the labeling:

\left(\begin{array}{ccccccccccc} 21 & 12 & 13 & 19 & 19& 20 & 0 & 23 & 3 & 25 & 22 \\ 0 & 1 & 0 & 8 & 14 & 11 & 24 & 26 &0 &0 & 22\end{array}\right)
\Downarrow
\text{``VAMBNATITOULAYX DAZAWW''}