Scramble! The Scytale and The Rail Fence

Transposition Ciphers

Scrambling the order of characters in a message is another well recognized method for enciphering, fundamentally different from the Shift Ciphers introduced earlier. Scrambling, aka a transposition cipher, does not change the letters in the message to produce the cipher text; it writes them down in a different order. Two simple tools for creating transposition ciphers are known from history: the Scytale (pronounced SKIT-uh-lee) and the Rail Fence.

Make Your Own Scytale

You can easily make your own Scytale for enciphering and deciphering messages using materials found at home, school, or in an office. 
Try enciphering and deciphering different messages.  What happens if you use a rod of different diameter to decipher a message?  Can you still read the original message? 

Materials

1x Cardboard or plastic tube, or a wooden dowel.

1x Roll of paper tape, masking tape, or painters tape. 

1x Scissors

1x Pen, pencil, or fine-tip marker.

Scytale

The Scytale is a rod of known size (e.g. diameter) around which a tape of paper or parchment is wound. The diameter of the rod is the key controlling how the text of the message is scrambled.

The original message is written in rows along the length of the rod. The enciphered message is read by unwrapping the paper tape. 

Send the enciphered message to the receiver, write on a paper tape (or send the tape itself), wrap it around a Scytale the same size, and read the message. 
The Scytale is ancient, in use by Greek (Spartan) military thousands of years ago!

 

Scytale Cipher as a Row-Column (i.e. a Matrix) Transposition 

The short video shows an alternative method of enciphering, by seeing the Scytale as a matrix, with the number of rows equal to the circumference of the rod measured in letters and the number of columns in the matrix equal to the length of the rod measured in letters. 
To encipher a message we write it into the rows of the matrix moving left to right until the end of the row is reached, then move down to the next row and continue. The enciphered message is written out column-by-column from top-to-bottom, moving from left-to-right to the top of the next column when the bottom character in a column is written out. 

Rail Fence

The Rail Fence cipher, also called the Zig-Zag cipher, is named for the mental image used to construct it.  Imagine a fence with horizontal rails; the number of rails in the fence is the cipher key. The characters in the original message (i.e., the plaintext) are written vertically on each rail from top to bottom, then bottom to top in a zig-zag pattern until all characters have been written. The “cipher-text” is read out row by row from the rails in the fence … all the characters in the top rail, then all the characters in the next, until the bottom rail of characters is reached and read out. 

Enciphering

With the image of the zig-zag pattern in mind, enciphering with the Rail Fence is straightforward. 

Deciphering with the Rail Fence

Deciphering a message encoded with the Rail Fence takes a little bit of math to find out how many letters are written on each rail in the decode table. The math is much simpler if there is a whole number of zig-zags in the enciphered message, as we shall see.

Rail Fence By the Numbers

To decipher a Rail-Fence enciphered message we must know the number of rails (this is the key) and find two numbers:

  • the length of one zig-zag sequence from top-rail to bottom-rail and back
  • the number of zig-zag sequences in the message. 

Those two numbers and the key determine the number of rows and columns in the decode table, and how many letters from the ciphertext to write across each of its rows.

Decode Table 

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

W

.

.

.

.

.

I

.

.

.

.

.

R

.

.

.

.

.

N

.

 

 

 

 

.

E

.

.

.

D

.

S

.

.

.

E

.

E

.

.

.

U

.

!

 

 

 

#

.

.

A

.

E

.

.

.

C

.

V

.

.

.

D

.

R

.

.

.

#

 

#

 

.

.

.

R

.

.

.

.

.

O

.

.

.

.

.

!

.

.

.

.

 

#

 

 

Zig-Zag Length

With N rails, we see that each Zig-Zag letter sequence starts at top rail, goes down N-1 letters to the bottom and returns up N-1 letters to start again. In general:  

 

  • P = 2(N-1)


For our four-rail example, the length of the Zig-Zag sequence is 6 characters. 

Number of Zig-Zags in the Message

The number of Zig-Zags K up and down the rail fence depends on the length L of the message and the length P of the Zig-Zag. In general, K, the number of Zig-Zags is

  • K = L / P

If we are lucky, the message is a whole number of Zig-Zags, as this makes the division of the ciphertext into sections much simpler.

For our example message that has 20 chatacters and Zig-Zag length 6 characters, the number of Zig-Zigs is not a whole number. The message 3-1/3 Zig-Zags long.