Grapes in the south part of Vojvodina

Ciphers, cryptography and communications II

09/08/2025

What now

This time I gonna go through two cipher-like things. Both of them are more like a device/method for encryption and decryption messages.

Scytale

Threat it more like a way to encode a decode messages with minimum effort. For communication both sides need to have a sticks with the same diameter\number of edges. During encryption you wrap a strip of leather around the stick and write your message line by line along the stick. Thеn you unwrap a strip and send it with your best runner. On other side, receiver wraps strip around stick with the same parameters and reads a message.

Yet it still a transpositional cipher. Literally transposition of matrix.

P=Iamhurtverybadlyhelp"=(Iamhurtverybadlyhelp)P = \text{\textquotedblleft}Iamhurtverybadlyhelp" = \begin{pmatrix} I & a & m & h & u \\ r & t & v & e & r \\ y & b & a & d & l \\ y & h & e & l & p \end{pmatrix} C=PT=(Iryyathbmvaehedlurlp)=Iryyatbhmvaehedlurlp"C = P^T = \begin{pmatrix} I & r & y & y \\ a & t & h & b \\ m & v & a & e \\ h & e & d & l \\ u & r & l & p \end{pmatrix} = \text{\textquotedblleft}Iryyatbhmvaehedlurlp"

Here is a small playground. You can change "size" of senders and receivers Scytale and check how cyphertext and decoding attempt changes.

Size of senders scytale 4
| | | | | | | | |
2 4 8 10

My uncle’s goodness is extreme, If seriously he hath disease;

Cyphertext:

Mn,hye e sI usfhn acistlsehe r ’eidsxoi tusgrseoelaomysde e

Decoding attempt:

My uncle’s goodness is extreme, If seriously he hath disease

Size of receivers scytale 4
2 4 8 10
| | | | | | | | |

Polybius square

Polybius square is also not a cipher on itself, but a device for encoding letters. Its nature is pretty simple you represent whole alphabet as a squared table and use letter indices to encode letter.

123451abcde2fghi/jk3lmnop4qrstu5vwxyz\def\arraystretch{1.5} \begin{array}{c:c:c:c:c:c:c} & 1 & 2 & 3 & 4 & 5 \\ \hdashline 1 & a & b & c & d & e \\ \hdashline 2 & f & g & h & i/j & k \\ \hdashline 3 & l & m & n & o & p \\ \hdashline 4 & q & r & s & t & u \\ \hdashline 5 & v & w & x & y & z \\ \hdashline \end{array}

So by presenting whole alphabet as a squared table we can encode letters as a pair of numbers. Encoding looks simple. You pick letter, check it's position in table and encode it as a pair of numbers.

For example, letter "a" is at position (1, 1), so it's encoded as "11". Similarly, letter "b" is at position (1, 2), so it's encoded as "12".

Hello is encoded as 23 15 31 31 34. World is encoded as 52 34 42 31 14.

Also it is first cipher in a series which introduces fractionation. When you use it to encode letters as numbers you get not one, but two symbols as output. It opens a pretty interesting way to use it even with a regular plain square.

Ways of encryption

Fractionation

Since each letter represented as pair of numbers you can shuffle them before sending to the recipient or use new pairs to decode them back to letters.

Hello world -> 23 15 31 31 34 52 34 42 31 14 -(circular shif left by 1)-> 31 53 13 13 45 23 44 23 11 42 -> lxccu hthar

Key-based square bootstrapping

First and the simplest one, you can introduce a key for bootstrapping square itself. For example, you can use a phrase to rearrange the letters in the square. This way, the same plaintext will produce different ciphertexts depending on the key used.

For example, let's pick keyphrase "Don’t leave your room". During bootstrap of the square we use letters from the phrase in order of its appearance. All missed letters goes in alphabetical order.

123451dontl2eavyu3rmbcf4ghi/jkp5qswxz\def\arraystretch{1.5} \begin{array}{c:c:c:c:c:c:c} & 1 & 2 & 3 & 4 & 5 \\ \hdashline 1 & d & o & n & t & l \\ \hdashline 2 & e & a & v & y & u \\ \hdashline 3 & r & m & b & c & f \\ \hdashline 4 & g & h & i/j & k & p \\ \hdashline 5 & q & s & w & x & z \\ \hdashline \end{array}

With this bootstrapped square our encoding looks like this:

Hello is encoded as 42 21 15 15 12. World is encoded as 53 12 31 15 11.

Alias for Caesar cipher with fixed shift

Since it it square 5x5 you can use it as a Caesar cipher with(mod6)\pmod {6}. It is a really neat representation of modular ariphmetics. To encode each letter you need to pick a letter which is suited right down below it. If you on a last row, you need to pick a letter from the first row.

Hello world encodes as nkqqt btwqi.

(You can check it here by setting n = 6)

Ofcourse you can pick letter from the row above one you want to encode, or even bootstrap your square in advance or combine it with fractional shift. Just do not forget to communicate your keyphrase and offset to the recipient.

Lil bit of history

Square itself is a useful tool for passing letters through a channel with a limited capacity.

For example you may use it to pass letters as a series of knocks on the wall. Let's compare it with just encoding letters as its position in the alphabet. This way worst letter is encoded by 26 sequential knocks. Best letter is encoded by 1 knock. It is easy to miss knocks when you need to count up to 26 at the same time. With square you can encode each letter with up to 5 + 5 knocks. So technically it should be faster and should reduce the chance of errors and kognitive load.

Or you may use it in a semaphore system. You need only 10 flags for representing one letter at a time.

Mastodon