january 30, 2006
DESCRIPTION
Team M1 Enigma Machine Adithya Attawar (M11) Shilpi Chakrabarti (M12) Zavo Gabriel (M13) Mike Sokolsky (M14). January 30, 2006 Original mechanical design revisited, High-level software simulation, Architecture flowcharts. Status. Finished: Design selections Block diagram for processes - PowerPoint PPT PresentationTRANSCRIPT
Team M1Team M1Enigma MachineEnigma Machine
Adithya Attawar (M11)Adithya Attawar (M11)Shilpi Chakrabarti (M12)Shilpi Chakrabarti (M12)
Zavo Gabriel (M13)Zavo Gabriel (M13)Mike Sokolsky (M14)Mike Sokolsky (M14)
January 30, 2006January 30, 2006Original mechanical design Original mechanical design
revisited, High-level software revisited, High-level software simulation, Architecture simulation, Architecture
flowchartsflowcharts
StatusStatus
Finished:Finished: Design selectionsDesign selections Block diagram for processesBlock diagram for processes High-level implementation in CHigh-level implementation in C
To Do:To Do: Behavioral Verilog (almost done)Behavioral Verilog (almost done) SchematicSchematic LayoutLayout TestingTesting SimulationSimulation
Functional DescriptionFunctional Description
Enigma Operation RevisitedEnigma Operation Revisited
Enigma Operation: Rotors & Enigma Operation: Rotors & ReflectorReflector
26 spring-loaded 26 spring-loaded contacts on each sidecontacts on each side
Set to an arbitrary initial Set to an arbitrary initial position for each position for each messagemessage
Each rotor has unique Each rotor has unique internal wiring to perform internal wiring to perform letter swapsletter swaps
Rightmost rotor steps Rightmost rotor steps one notch with each one notch with each keystroke, the others keystroke, the others every 26, 26every 26, 2622, etc., etc.
Reflector does not move; Reflector does not move; hard-wired; swaps letters hard-wired; swaps letters and ‘reflects’ signal back and ‘reflects’ signal back through rotorsthrough rotors
Enigma Operation: Enigma Operation: SteckerboardSteckerboard
Manually wired and Manually wired and changed dailychanged daily
Daily settings Daily settings specified in codebooks specified in codebooks given to operatorsgiven to operators
Matched letter pairs Matched letter pairs (A-J, J-A)(A-J, J-A)
Increased number of Increased number of possible machine possible machine configurations by configurations by 26*24*22*… = ~1026*24*22*… = ~101313
Design DecisionsDesign Decisions Revised entire system architectureRevised entire system architecture
Modular design – able to add/revise components Modular design – able to add/revise components without changing basic architecturewithout changing basic architecture
Implement steckerboard, rotors, reflector Implement steckerboard, rotors, reflector using memoriesusing memories Address: (Character + Wheel Position)%26Address: (Character + Wheel Position)%26 Value in cell: New character for next swapValue in cell: New character for next swap Will need to implement a 5-bit modulo-26 adderWill need to implement a 5-bit modulo-26 adder
Serial input of initial rotor settings/orderSerial input of initial rotor settings/order
Steckerboard MemorySteckerboard Memory
26x5-bit cells26x5-bit cells Programmable by user on startupProgrammable by user on startup Stores information about swapsStores information about swaps
newChar = stecker[currentChar]newChar = stecker[currentChar]Swaps Swaps MUST BEMUST BE matched pairsmatched pairs::
If stecker[A] = ‘G’ then stecker[G] = ‘A’If stecker[A] = ‘G’ then stecker[G] = ‘A’
Rotor and Reflector Rotor and Reflector MemoryMemory
Same basic idea as SteckerboardSame basic idea as Steckerboard 8 “rotors”:8 “rotors”:
26x5-bit cells26x5-bit cells Swaps are Swaps are NOTNOT matched pairs matched pairs
1 “reflector”1 “reflector” 26x5-bit cells26x5-bit cells Swaps Swaps MUST BEMUST BE matched pairs matched pairs
Differences:Differences: Not programmable: bits in memory are Not programmable: bits in memory are
permanently set during manufacturingpermanently set during manufacturing Swap pairs unique to each wheelSwap pairs unique to each wheel
Control logic specifies how many “rotors” used, Control logic specifies how many “rotors” used, in what “position,” and in what orderin what “position,” and in what order
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Character InputCharacter Input
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Steckerboard SwapSteckerboard Swap& Increment Wheels& Increment Wheels
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Calculate Rotor SwapCalculate Rotor Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Store New CharacterStore New Characterfrom Rotor Swapfrom Rotor Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Calculate Reflector SwapCalculate Reflector Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Store New CharacterStore New Characterfrom Reflector Swapfrom Reflector Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Calculate Reverse Calculate Reverse Rotor SwapRotor Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Store New CharacterStore New Characterfrom Reverse Rotor Swapfrom Reverse Rotor Swap
N-Reg C-Reg
5-bit%26
Adder
+ 13 % 26
ROM232X
5bit
RAM26
X5bit
O-Reg
I-Reg
WheelSelect
WheelPos
PlugInput
Steckerboard SwapSteckerboard Swap& Output Encrypted& Output EncryptedCharacterCharacter
Implementation in C Implementation in C (snippet)(snippet)
while((ch_in=(char)getchar())!=10){ // take input until <ENTER>while((ch_in=(char)getchar())!=10){ // take input until <ENTER> c_reg = (unsigned short) ch_in - 97; // ASCII 'a' is value 97 so correct to a=0c_reg = (unsigned short) ch_in - 97; // ASCII 'a' is value 97 so correct to a=0 if(c_reg>25)if(c_reg>25) exit(0);exit(0); if((wheel_pos[wheel_order[0]] = (wheel_pos[wheel_order[0]]+1)%26)==0) // rotate wheelsif((wheel_pos[wheel_order[0]] = (wheel_pos[wheel_order[0]]+1)%26)==0) // rotate wheels if((wheel_pos[wheel_order[1]] = (wheel_pos[wheel_order[1]]+1)%26)==0)if((wheel_pos[wheel_order[1]] = (wheel_pos[wheel_order[1]]+1)%26)==0) if((wheel_pos[wheel_order[2]] = (wheel_pos[wheel_order[2]]+1)%26)==0)if((wheel_pos[wheel_order[2]] = (wheel_pos[wheel_order[2]]+1)%26)==0) if((wheel_pos[wheel_order[3]] = (wheel_pos[wheel_order[3]]if((wheel_pos[wheel_order[3]] = (wheel_pos[wheel_order[3]]
+1)%26)==0)+1)%26)==0) if((wheel_pos[wheel_order[4]] = if((wheel_pos[wheel_order[4]] =
(wheel_pos[wheel_order[4]]+1)%26)==0)(wheel_pos[wheel_order[4]]+1)%26)==0)
if((wheel_pos[wheel_order[5]] = (wheel_pos[wheel_order[5]]+1)%26)==0)if((wheel_pos[wheel_order[5]] = (wheel_pos[wheel_order[5]]+1)%26)==0)
if((wheel_pos[wheel_order[6]] = (wheel_pos[wheel_order[6]]+1)%26)==0)if((wheel_pos[wheel_order[6]] = (wheel_pos[wheel_order[6]]+1)%26)==0)
if((wheel_pos[wheel_order[7]] = (wheel_pos[wheel_order[7]]+1)%26)==0);if((wheel_pos[wheel_order[7]] = (wheel_pos[wheel_order[7]]+1)%26)==0); //printf("%d %d ",wheel_pos[wheel_order[0]],wheel_pos[wheel_order[1]]);//printf("%d %d ",wheel_pos[wheel_order[0]],wheel_pos[wheel_order[1]]); if(use_stecker) // initial stecker useif(use_stecker) // initial stecker use c_reg = stecker[c_reg];c_reg = stecker[c_reg]; for(i=0;i<num_wheels;i++) { // step through wheelsfor(i=0;i<num_wheels;i++) { // step through wheels c_reg = wheel_settings[wheel_order[i]][(c_reg+wheel_pos[wheel_order[i]])%26];c_reg = wheel_settings[wheel_order[i]][(c_reg+wheel_pos[wheel_order[i]])%26]; if(DEBUG)if(DEBUG) printf("%c ",(char)(c_reg+97));printf("%c ",(char)(c_reg+97)); }} if(reflect){ // if we're reflecting, which it looks like you have to do for it to workif(reflect){ // if we're reflecting, which it looks like you have to do for it to work c_reg = reflector[c_reg]; // look up new value in reflectorc_reg = reflector[c_reg]; // look up new value in reflector if(DEBUG)if(DEBUG) printf("%c ",(char)(c_reg+97));printf("%c ",(char)(c_reg+97)); for(i=num_wheels-1;i>=0;i--){ // now go through backwards, find the location in the wheel that holdsfor(i=num_wheels-1;i>=0;i--){ // now go through backwards, find the location in the wheel that holds j=0;j=0;
// the value of c_reg, and // the value of c_reg, and save the location into c_regsave the location into c_reg
while(wheel_settings[wheel_order[i]][(j+wheel_pos[wheel_order[i]])%26]!=c_reg)while(wheel_settings[wheel_order[i]][(j+wheel_pos[wheel_order[i]])%26]!=c_reg) j++;j++; c_reg = j;c_reg = j; if(DEBUG)if(DEBUG) printf("%c ",(char)(c_reg+97));printf("%c ",(char)(c_reg+97));
Implementation in CImplementation in C
Fully simulates an Enigma with up to Fully simulates an Enigma with up to 8 rotors, a reflector, and a 8 rotors, a reflector, and a steckerboardsteckerboard
Sample outputSample output 3 rotors: order 1-2-0, setting F-H-J3 rotors: order 1-2-0, setting F-H-J 5 stecker pairings: AP, CN, HS, KT, VX5 stecker pairings: AP, CN, HS, KT, VX
cmu-163055:~/Documents/Programs/Enigma mvs$ ./enigmahelloworld (Input string from user)xoserrykrb (Encoded output)cmu-163055:~/Documents/Programs/Enigma mvs$ ./enigmaxoserrykrb (Input string – the encoded text back in)helloworld (Output – encrypt and decrypt are the same)
Problems & QuestionsProblems & Questions
How to make it more secure?How to make it more secure? Variable rotor increments?Variable rotor increments?
Must be some function of input character to Must be some function of input character to preserve symmetrical encrypt/decryptpreserve symmetrical encrypt/decrypt
Otherwise you lose your message!Otherwise you lose your message!