Enigma/primer

From Teknologisk videncenter
< Enigma
Revision as of 10:35, 5 December 2010 by Heth (talk | contribs) (The software enigma)
Jump to: navigation, search

The Wheels

The Wheels can be installed in the Enigma in any sequence. If there are five different Wheels in total and the Enigma uses three Wheels. The total number of Wheel combinatins would be <math>5*4*3=60</math>

The actual mechanical Roters in a World War II Enigma. Notice Route Reflector B is installed
The scrambling action of the Enigma rotors are shown for two consecutive letters.

The software enigma

In the software Enigma you would need some random Wheels and a Random Rotor Reftlector. For examle this three bit Enigma.

/*  Input/output               0,   1,   2,   3,   4,   5,   6,   7  */
byte wheel[2][8] = {
/* Wheel 1 */               {  2,   7,   1,   5,   6,   3,   0,   4},
/* Wheel 2 */               {  5,   0,   7,   2,   1,   6,   4,   3} };

/* Notch array for wheels*/
byte wheel_notch[2] =       { 3, 6 };

byte rwheel[2][8] = {
/* Reverse wheel 1 */       {  6,   2,   0,   5,   7,   3,   4,   1},
/* Reverse wheel 2 */       {  1,   4,   3,   7,   6,   0,   5,   2} };

/* Rotor reflector*/
byte rr[8] =                {  7,   4,   6,   5,   1,   3,   2,   0};