# Apply a permutation cipher by hand

I did the following problem from the book "Cryptography Theory and Practice" as I am doing some self-study.

Problem:

a) Suppose that $\pi$ is the following permutations of the set $\lbrace 1,\dots,8 \rbrace$: $$\pi=\begin{pmatrix} 1 &2& 3& 4& 5& 6& 7& 8\\ 4& 1& 6& 2& 7& 3& 8& 5 \end{pmatrix}$$
Compute the permutation $\pi^{-1}$.

b) Decrypt the following cipher text, for a permutation Cipher with $m = 8$, which was encrypted using the key $\pi$:

${\bf TGEEMNLENNTDROEOAAHDOETCSHAEITLM.}$

a)$$\pi^{-1}=\begin{pmatrix} 1 &2& 3& 4& 5& 6& 7& 8\\ 2& 4& 6& 1& 8& 3& 5& 7 \end{pmatrix}$$

b) To decrypt, I partition the text into groups of 8 giving.

${\bf TGEEMNLE\ \ NNTDROEOA\ \ AHDOETCS\ \ HAEITLM.}$

${\bf TGEEMNLE}$ decrpyts to ${\bf ETNGLEEM.}$

I am fairly sure that this is wrong. However, I do not know what I did wrong. Please help.

Bob

• FWIW: I agree with your $\pi^{-1}$ and I get the same "decryption" assuming it works via blocks as claimed. Did you try the other blocks? Isn't it a columnar transposition? Feb 9 '17 at 2:25

Apply the $\pi^{-1}$ to all the blocks. Then put them under each other so we get colums of length 4 in this case. Then read out left to right, up to down instead (zig-zag).
Your $\pi^{-1}$ is correct but for decryption you can do this:
$\pi^{-1}\begin{pmatrix} T&G&E&E&M&N&L&E\\ 1&2&3&4&5&6&7&8\\ N&N&T&D&R&O&E&O\\ 1&2&3&4&5&6&7&8\\A&A&H&D&O&E&T&C\\ 1&2&3&4&5&6&7&8\\ S&H&A&E&I&T&L&M\\ 1&2&3&4&5&6&7&8\\ \end{pmatrix}= \begin{matrix} G&E&N&T&E&E&M&L\\2&4&6&1&8&3&5&7\\N&D&O&N&O&T&R&E\\2&4&6&1&8&3&5&7\\A&D&E&A&C&H&O&T\\2&4&6&1&8&3&5&7\\H&E&T&S&M&A&I&L\\2&4&6&1&8&3&5&7\\ \end{matrix}.$
So decrypted message is: ${\bf GENTEEML\ \ NDONOTRE\ \ ADEACHOT\ \ HETSMAIL.}$
Note that ${\bf TGEEMNLE}$ encrypts to ${\bf ETNGLEEM}$, Not decrypts to.