ECB mode decryption

277 Views Asked by At

I have used the ECB mode (with block length $4$) to encrypt the message $m=1011000101001010$ into $c=0010011001001101$ using the key

$$\pi = \begin{pmatrix}1&2&3&4\\2&3&4&1\end{pmatrix}$$

and initialisation vector $IV=1010$. Now I to decrypt it we used the key

$$\pi^{-1} = \begin{pmatrix}1&2&3&4\\4&1&2&3\end{pmatrix}$$

however isn't the inverse of a permutation it written backwards? In this case shouldn't we have

$$\pi^{-1} = \begin{pmatrix}1&2&3&4\\1&4&3&2\end{pmatrix}$$

Why is it the first one?

2

There are 2 best solutions below

0
On BEST ANSWER

If you are using cyclic notation, $\pi=(1234)$. And $\pi^{-1}=(4321)$, which is just $\pi$ written backwards. But in the matrix notation that you are using, you form the inverse by exchanging the top and bottom rows. So $$\pi^{-1} = \begin{pmatrix}2&3&4&1\\1&2&3&4\end{pmatrix}$$ which, after rearranging the columns, is the same as $$\begin{pmatrix}1&2&3&4\\4&1&2&3\end{pmatrix}$$

0
On

No. The inverse permutation is the one that puts everything back where it came from ($\pi(1) = 2$, so $\pi^{-1}(2) = 1$, and so on), which means that you get the inverse by swapping the two rows: $$ \pi^{-1} = \begin{pmatrix}2&3&4&1\\1&2&3&4\end{pmatrix} $$ Usually one also sorts the columns for easy readability, so that we get $$ \pi^{-1} = \begin{pmatrix}1&2&3&4\\4&1&2&3\end{pmatrix} $$