From 3b3f0162d4612e39fdaef72c30e83016477d5e2f Mon Sep 17 00:00:00 2001 From: rzen Date: Sun, 27 Sep 2020 13:02:21 -0400 Subject: [PATCH] wip on configuration --- enigma.ino | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/enigma.ino b/enigma.ino index 8fcca6e..1b3e74b 100644 --- a/enigma.ino +++ b/enigma.ino @@ -80,7 +80,7 @@ EnigmaType enigma_types[] = { { rotors[1], rotors[2], rotors[3], rotors[4], rotors[5], rotors[6], rotors[7], rotors[8] }, { rotors[11], rotors[12] } } -}; +}; // entry wheel "EintrittswalzeEintrittswalze" byte entry_wheel_type = 0; // @@ -383,7 +383,32 @@ void demo () { } +enum ConfigOptionType { YesNo, EnigmaList, RotorList, ThinRotorList, Plugboard, Scalar }; + +typedef struct { + char *prompt; + ConfigOptionType type; + void *target; + void (*skip) (); + void (*blink) (); +} ConfigOption; + +EnigmaType enigma_type; + +ConfigOption config_options[] = { + { "Demo?", YesNo, &demo_mode, NULL, NULL }, + { "Enigma Type?", EnigmaList, &enigma_type, NULL, NULL }, + { "Right Rotor?", RotorList, &rotor_type[0], NULL, NULL }, + { "Middle Rotor?", RotorList, &rotor_type[1], NULL, NULL }, + { "Left Rotor?", RotorList, &rotor_type[2], NULL, NULL }, + { "Thin Rotor?", ThinRotorList, &rotor_type[2], NULL, NULL }, + { "Plugboard?", Plugboard, &plugboard, NULL, NULL } +}; + +int config_option_index = 0; + void config () { + // demo? y/n -> demo_mode // enigma type? menu -> enigma_type // rotor[ @@ -414,6 +439,80 @@ void loop () { /* https://cryptocellar.org/Enigma/index.html +https://cryptocellar.org http://www.mlb.co.jp/linux/science/genigma/enigma-referat/node4.html#SECTION00043000000000000000 - +http://www.macs.hw.ac.uk/~foss/valentin/Naval%20Enigma.html +https://github.com/melick/enigma +https://www.codesandciphers.org.uk/enigma/example1.htm +https://www.codesandciphers.org.uk/enigma/index.htm +https://www.codesandciphers.org.uk/enigma/enigma2.htm */ + + +/* + +Codebook + ++------------------------------------------------+ +| 30 | I V IV | VAX | AX CE DK IM TG WF | LQT | ++------------------------------------------------+ +| 29 | IV V II | JNF | AL KI MT NB UH ZR | SYO | ++------------------------------------------------+ +| 28 | III IV II | FHT | AW IS JR KB YH ZX | TJE | ++------------------------------------------------+ +| 27 | V III I | OQY | AZ CV DN FJ TU WP | IIF | ++------------------------------------------------+ +| 26 | IV I V | GRT | BG ER IJ LF OC ZP | GST | ++------------------------------------------------+ +| 25 | V II IV | HCE | BR CJ QX UF YO ZT | OJT | ++------------------------------------------------+ +| 24 | III V IV | FAK | IQ RH UZ WM XJ YC | BKW | ++------------------------------------------------+ +| 23 | II III I | QMD | CQ IH KY RW VL XT | QSU | ++------------------------------------------------+ +| 22 | II IV III | JSI | AN FH JV ML RO WD | KNQ | ++------------------------------------------------+ +| 21 | II IV I | JMY | AP BM GD NS QV RC | HWO | ++------------------------------------------------+ +| 20 | IV I III | GMX | AB TD WE XH YP ZF | BOD | ++------------------------------------------------+ +| 19 | V III II | COA | FR IT PE QD SH XZ | EGM | ++------------------------------------------------+ +| 18 | V II I | VTU | FJ GR KC LS NX WA | MTJ | ++------------------------------------------------+ +| 17 | II I III | KKX | BV CO LG MK SY WN | JLY | ++------------------------------------------------+ +| 16 | II I III | MJO | GQ IL KF OD PS UC | NBV | ++------------------------------------------------+ +| 15 | II V IV | MFX | CL DS HK JX MW YN | IEU | ++------------------------------------------------+ +| 14 | I V II | TTN | DA IH JS KU TP WZ | MYF | ++------------------------------------------------+ +| 13 | IV V I | TEV | AP CM LB NZ UI XS | KJP | ++------------------------------------------------+ +| 12 | III II IV | RXS | BO CL DY GR SI WA | EAF | ++------------------------------------------------+ +| 11 | II III I | MXN | CZ KB ME NL QP TS | BLW | ++------------------------------------------------+ +| 10 | I IV II | OHP | FU GR LJ OA QX VI | LEB | ++------------------------------------------------+ +| 9 | III I V | PQY | AG MC NU QI TX ZV | NWT | ++------------------------------------------------+ +| 8 | III I V | CJN | AN EC OK UI WT YB | BTD | ++------------------------------------------------+ +| 7 | II IV I | HJI | CM HX KW SJ TI UQ | MPD | ++------------------------------------------------+ +| 6 | II I III | HID | AP BM GK TY VJ XI | JIJ | ++------------------------------------------------+ +| 5 | II V I | ESJ | FV JK OT PY SE ZH | XMB | ++------------------------------------------------+ +| 4 | IV I III | JJN | AE NH OU VR XZ YQ | WTV | ++------------------------------------------------+ +| 3 | V II I | MPB | BU LS ND PG TA XM | OFS | ++------------------------------------------------+ +| 2 | III II V | NXR | BR GV HN MD WL ZI | KSU | ++------------------------------------------------+ +| 1 | I IV V | PIE | MC OG SH VI WL YQ | RBU | ++------------------------------------------------+ + + */