encrypt with permutation ciphers
-
29-09-2020 - |
Question
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.
Solution
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.
OTHER TIPS
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.