[JoGu]

Cryptology

One-Rotor Ciphers

a7Hzq .#5r<
kÜ\as TâÆK$
ûj(Ö2 ñw%h:
Úk{4R f~`z8
¤˜Æ+Ô „&¢Dø

Rotor machines work by executing several monoalphabetic substitutions one after each other. These substitutions change with each position in the text, so we have a polyalphabetic cipher. The single monoalphabetic substitutions each are performed by a »rotor«.

For better understanding we first analyze the working of a single rotor.

Principle 1: Substitution

A rotor is a thick disk that has near its outer circumference on both sides as many electric contacts as letters in the alphabet (in history usually 26—early versions of the Enigma used 28 or 29 letters). Here is an Enigma rotor as seen from both sides:

[Rotor von links]   [Rotor von rechts]

The contacts of the two sides are pairwise connected by wires in an erratic way [first picture: Hebern-rotor, second picture: Enigma rotor]:

[A Hebern rotor]   [Inside an Enigma rotor]

By this wiring the rotor performs a monoalphabetic substitution as follows:

The contacts of one side, the »input side«, are connected with a keybord, those of the other side, the »output side«, with an output device, for example with a printer (or typewriter) or with a small light bulb that shows a letter.

[Encrypting with one rotor]

Description by Strips

If, like for disk ciphers, we want to describe this procedure using strips instead of a disk, we have to take to a somewhat more involved construction:

Input (plaintext):    a b c d e f g h i j k l m n o p q r s t u v w x y z
                      |               #
Rotor entry:          A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Rotor exit:           Q W E R T Z U I O P A S D F G H J K L Y X C V B N M
                                    #     |                 
Output (ciphertext):  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Imagine each letter of the input side connected with the same letter of the output side—the »erratic wiring« is hidden between the lines »rotor entry« and »rotor exit«. The labelling of the contacts by letters illustrates the assignment of input and output contacts, it has no meaning beyond this, we could use numbers instead (as below). or simply dots connected by lines.

The letters seen on the Enigma rotor above serve for setting the initial position as a part of the key.

In the example a is transformed to K, and i to H.


Principle 2: Rotation

For each letter the rotor rotates to a new position. This movement effects a polyalphabetic substitution.

Let's look at the example and move the rotor by one position. Then the input letter a is connected to the contact Z, or 25 if we now denote the contacts by numbers, etc. Let's also turn the strips to the vertical. Note that the contacts for input and those for output—as well as the wires between then—move down by 1 position. The input letters a...z and the output letters A...Z face new contact points:

Initial position --> Next position

a--00-+ 16  A        a--25-+ 12  A
b  01 | 22  B        b  00 | 16  B
c  02 | 04  C        c  01 | 22  C
d  03 | 17  D        d  02 | 04  D
e  04 | 19  E        e  03 | 17  E
f  05 | 25  F        f  04 | 19  F
g  06 | 20  G        g  05 +-25--G
h  07 #=08==H        h  06   20  H
i==08=# 14  I        i==07=# 08  I
j  09 | 15  J        j  08 | 14  J
k  10 +-00--K        k  09 | 15  K
l  11   18  L        l  10 | 00  L
m  12   03  M        m  11 | 18  M
n  13   05  N        n  12 | 03  N
o  14   06  O        o  13 | 05  O
p  15   07  P        p  14 | 06  P
q  16   09  Q        q  15 #=07==Q
r  17   10  R        r  16   09  R
s  18   11  S        s  17   10  S
t  19   24  T        t  18   11  T
u  20   23  U        u  19   24  U
v  21   02  V        v  20   23  V
w  22   21  W        w  21   02  W
x  23   01  X        x  22   21  X
y  24   13  Y        y  23   01  Y
z  25   12  Z        z  24   13  Z

a becomes K          a becomes G
i becomes H          i becomes Q

After the rotation a is tranformed to G, and i to Q.

Description by a Table

There 26 different possible positions of the rotor, that is 26 different alphabets. These are given as the rows of the following table.

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    ---------------------------------------------------
 0  K X V M C N O P H Q R S Z Y I J A D L E G W B U T F
 1  G L Y W N D O P Q I R S T A Z J K B E M F H X C V U
 2  V H M Z X O E P Q R J S T U B A K L C F N G I Y D W
 3  X W I N A Y P F Q R S K T U V C B L M D G O H J Z E
 4  F Y X J O B Z Q G R S T L U V W D C M N E H P I K A
 5  B G Z Y K P C A R H S T U M V W X E D N O F I Q J L
 6  M C H A Z L Q D B S I T U V N W X Y F E O P G J R K
 7  L N D I B A M R E C T J U V W O X Y Z G F P Q H K S
 8  T M O E J C B N S F D U K V W X P Y Z A H G Q R I L
 9  M U N P F K D C O T G E V L W X Y Q Z A B I H R S J
10  K N V O Q G L E D P U H F W M X Y Z R A B C J I S T
11  U L O W P R H M F E Q V I G X N Y Z A S B C D K J T
12  U V M P X Q S I N G F R W J H Y O Z A B T C D E L K
13  L V W N Q Y R T J O H G S X K I Z P A B C U D E F M
14  N M W X O R Z S U K P I H T Y L J A Q B C D V E F G
15  H O N X Y P S A T V L Q J I U Z M K B R C D E W F G
16  H I P O Y Z Q T B U W M R K J V A N L C S D E F X G
17  H I J Q P Z A R U C V X N S L K W B O M D T E F G Y
18  Z I J K R Q A B S V D W Y O T M L X C P N E U F G H
19  I A J K L S R B C T W E X Z P U N M Y D Q O F V G H
20  I J B K L M T S C D U X F Y A Q V O N Z E R P G W H
21  I J K C L M N U T D E V Y G Z B R W P O A F S Q H X
22  Y J K L D M N O V U E F W Z H A C S X Q P B G T R I
23  J Z K L M E N O P W V F G X A I B D T Y R Q C H U S
24  T K A L M N F O P Q X W G H Y B J C E U Z S R D I V
25  W U L B M N O G P Q R Y X H I Z C K D F V A T S E J

The primary alphabet describes the initial position of the rotor and is in row 0.

Note that the primary alphabet is the inverse of the »rotor wiring alphabet«.
The accompagnying secondary alphabets are called »rotated« alphabets—or »conjugated« alphabets. As the table clearly shows these are not the shifted alphabets produced by PORTA's cipher disk. The mathematical description of the accompanying alphabets is here.

The secondary alphabets, as elsewhere, may follow each other in a progressive or in a key-dependent way. This is controlled by the mechanics of the rotor movement.

Here is a simulation in cardboard (for easy construction with pencil and scissors). The template may be helpful.

Observations

The alphabet table for a rotor is sometimes called a »FRIEDMAN square«.

The Direction of Rotor Movement

The elementary rotation as described above was downwards when seen from the front. The position indicator—the number or letter that corresponds to the input letter a—then follows the sequence 00 25 24 ... or A Z Y .... The HEBERN machine as well as the Enigma had the indicators in the reverse order such that they follow the sequence 00 01 02 ... or A B C ... when the rotor moves one step downwards (seen from the operator).

The corresponding FRIEDMAN square then has the standard alphabet in its secondary diagonals in ascending direction.

When simulating rotor machines in software we must account for this effect.


Here is a Perl program that performs a one-rotor cipher.


Author: Klaus Pommerening, 1999-Dec-05; last change: 2014-Feb-22.