2
$\begingroup$

Most cryptographers know the scytale. It is that cipher where you roll a leather strip around a rod and then write text on it. For encryption you roll it off the stick and for decryption you roll it back on the stick. It can be visualized like that (from Wikipedia):

   |   |   |   |   |   |  |
   | I | a | m | h | u |  |
 __| r | t | v | e | r |__|
|  | y | b | a | d | l |
|  | y | h | e | l | p |
|  |   |   |   |   |   |

Now I was wondering how to formulate that mathematically correct. I tried some stuff, but I could not find a function (as for example with Caesar: $c_i = m_i + k \mod 26$), that represented the cipher correctly. Can someone help me?

$\endgroup$
1
  • $\begingroup$ In your example (which is 20 letters long, with 5 letters to a row), if we write $p_0$ for the first character, then the map is $c_i=p_{5i\mod{19}}$ for $0\le i\le 18$ and $c_{19}=p_{19}$. $\endgroup$
    – Daniel S
    Apr 5, 2022 at 12:57

1 Answer 1

4
$\begingroup$

The modern term is interleaving, i.e., read in by row, read out by column.

Let the plaintext be $[x(0),\ldots,x(mn-1)]$ where $m$ is the number of rows and $n$ is the number of columns, with padding if necessary to get a plaintext length that is a rectangular number of the form $mn$.

The index $k$ for $x(k)$ can be decomposed as $k=im+j$ with $0\leq i \leq n-1$ and $0\leq j \leq n-1.$ Note that $i=k\pmod n$ and $j=k\pmod m.$

Then the ciphertext is $[y(0),\ldots,y(mn-1)]$ where $y(k)=y(im+j)=x(jn+i).$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.