January 30, 2006

21
Team M1 Team M1 Enigma Machine Enigma 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, 2006 January 30, 2006 Original mechanical design Original mechanical design revisited, High-level revisited, High-level software simulation, software simulation, Architecture flowcharts Architecture flowcharts

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 Presentation

Transcript of January 30, 2006

Page 1: January 30, 2006

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

Page 2: January 30, 2006

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

Page 3: January 30, 2006

Functional DescriptionFunctional Description

Enigma Operation RevisitedEnigma Operation Revisited

Page 4: January 30, 2006

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

Page 5: January 30, 2006

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

Page 6: January 30, 2006

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

Page 7: January 30, 2006

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’

Page 8: January 30, 2006

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

Page 9: January 30, 2006

N-Reg C-Reg

5-bit%26

Adder

+ 13 % 26

ROM232X

5bit

RAM26

X5bit

O-Reg

I-Reg

WheelSelect

WheelPos

PlugInput

Page 10: January 30, 2006

N-Reg C-Reg

5-bit%26

Adder

+ 13 % 26

ROM232X

5bit

RAM26

X5bit

O-Reg

I-Reg

WheelSelect

WheelPos

PlugInput

Character InputCharacter Input

Page 11: January 30, 2006

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

Page 12: January 30, 2006

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

Page 13: January 30, 2006

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

Page 14: January 30, 2006

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

Page 15: January 30, 2006

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

Page 16: January 30, 2006

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

Page 17: January 30, 2006

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

Page 18: January 30, 2006

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

Page 19: January 30, 2006

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));

Page 20: January 30, 2006

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)

Page 21: January 30, 2006

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!