markusschanta / openenigma Goto Github PK
View Code? Open in Web Editor NEWOpen Enigma - This repository contains the Arduino code for the S&T GeoTronics M4 Enigma.
License: MIT License
Open Enigma - This repository contains the Arduino code for the S&T GeoTronics M4 Enigma.
License: MIT License
The lamp field on the latest PCB revision does not work with this code. The latest version integrates the plug board and non-plug board functionality and also has provisions for a serial printer.
Per http://users.telenet.be/d.rijmenants/en/enigmatech.htm#reflector:
=====================
"During the Second World War two types of reflector, B and C, were used.
Both had 26 spring-loaded contacts on the right side.
The four-rotor Kriegsmarine Enigmas used special thin reflectors, also called B and C, but with wiring that was different from the wiring of the three-rotor Wehrmacht and Luftwaffe reflectors.
However, if the thin Kriegsmarine reflector B was used together with the fourth Beta rotor in A-position and A-ringsetting or the C reflector with Gamme rotor, these reflectors were compatible with the three-rotor versions, enabling communication between different machine types."
======================
So, if the M4 is used with the B fourth rotor with rings and start position at "A", along with the Thin B M4 reflector, coding results should be identical with the M3 model and regular B reflector.
This works in the current Open Enigma code, but only because, in M3 mode, the wiring is routed through the (hidden) fourth rotor in default "A" positions and the thin "B" reflector, in "compatibility mode" as it were. This makes it unnecessary to code the unique normal M3 "B" reflector wiring in the forward rotor wiring table, even though the array has room for three reflector wiring sets.
Where this does NOT work in the current code is the case where the M3 is using the normal wide M3 C reflector. The current code routes the letter through the (hidden) Beta rotor and M4 thin B reflector, which doe NOT produce the equivalent result as an M3 using the M3 wide C reflector.
A hack to get around this if the correct M3 wide C reflector values are desired is to first put the machine in default M4 mode, set the Gamma rotor and C thin reflector, then switch to M3 mode and the C reflector. This produces the correct M3 encoding.
This is really ugly, as it depends upon setting the M4 in a compatible M3 mode, then switching to M3 mode which uses the M4 compatibility functionality to produce a correct M3 result.
A better way would be to encode the correct M3 B and C rotor settings in lines 156 and 160 of the current code. Then, the logic at line 494 where the reflector is applied would need to change to include the "behavior" variable in the index to access the correct portion of the array, rather than always choosing the first 26 reflector mapping values. The placeholders in the array are already there for this.
Also. the fourth rotor should not be used for encoding M3 traffic, as this assumes the ring and start positions are always at "A". The operator could change these, in M4 mode, then switch to M3 mode, not realizing the non-default M4 fourth rotor settings are screwing up the reflector operation. M4 settings should not be affecting M3 operation.
=====================================
Example - All setting at power-up defaults, no plugs, except for changing fourth rotor and reflector settings as indicated
Examples are the encoding of my name, DON.
M4 with B fourth rotor and B (thin) reflector: MIO
M3 with B (wide) reflector (should be same as above): MIO = CORRECT!
M4 with G fourth rotor and C (thin) reflector: TQE
M3 with C (wide) reflector (should be same as above): YLJ - INCORRECT!
M3 with C (wide) reflector, after changing modes from M4, where G rotor and C reflector were chosen: TQE - CORRECT!, but M4 settings should not be affecting M3 operation.
=====================================
Correct M3 and M4 reflector values (from http://users.telenet.be/d.rijmenants/en/enigmatech.htm#reflector):
M3 with "wide" reflectors
M4 with "thin" reflectors
My changes fix the M3 UKW-C bug and makes the settings for M3 reflectors independent of M4 fourth rotor and M4 reflector selections. I added the M3 "wide" reflector definitions into the reflector arrays (lines 161 and 166) and changed the "Run" mode reflector operation to index into the reflector array to access the correct reflector values depending upon the current model "behavior" variable (line 503).
I also made the fourth rotor to and from reflector transformations conditional upon being in "behaviors" 0 and 1, the M4 modes. They are now skipped completely in M3 mode (lines 492, 500, 507, and 515).
I used the new M3 B and C "wide" reflector definitions found here:
http://users.telenet.be/d.rijmenants/en/enigmatech.htm
Contact me for the plugboard code, with fixes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.