# encrypt with permutation ciphers

I came across this question:

You are given a permutation cipher defined by the bijection t: N -> N where,

t(i) = i + 10, for i < 10,
t(i) = i - 10, for 10 <= i <= 20, and
t(i) = i, for i > 20.


Assume that the first index is 0, given a message m = 'HELLO WORLD AND THIS IS A SECRET MESSAGE', what is the ciphertext c?

Where the answer was the following:

D AND THISHELLO WORL IS A SECRET MESSAGE


but i don't get how. That's now what we get if the message is spelled out diagonally down and up over a number of rows and then read off row-by-row.

Just apply the given permutation on the string.

Your string is : 'HELLO WORLD AND THIS IS A SECRET MESSAGE'.

Now, to apply the given permutation, we have to shift the first 10 characters rightward by 10 units, and the next 10 characters leftwards by 10 units, while leaving the rest same. Note that you also need to count the spaces.

Let the original message be $$m$$ and let the ciphertext be $$c$$. Then $$c_i = m_{t(i)}.$$ (Or perhaps it's the other way around. For our $$t$$ it doesn't matter, since it's an involution.)

If you apply this transformation to the given message, you'll get the given ciphertext.

• But how..? Could you give an example? For example, the first character is H. Do i add 10 and write the alphabet I get? Like in Rot13? But in that case it's R, not D.
– x89
Commented Apr 24, 2020 at 20:04
• If you spend a few hours on it, surely you'll get it eventually. Commented Apr 24, 2020 at 20:05
• I think that your problem is that you have a mental picture of what a permutation cipher is, but it doesn't correspond to what's in the question. For you, a permutation cipher changes every A to B (say). In the question, a permutation cipher permutes the order of the letters, in this case exchanging the first 10 letters with the following 10 letters. Commented Apr 24, 2020 at 20:07
• It's really an exercise in reading comprehension. Commented Apr 24, 2020 at 20:07