Code Monkey home page Code Monkey logo

openenigma's Introduction

Open Enigma

Banner

This repository contains the Arduino code for the S&T GeoTronics M4 Enigma. The S&T GeoTronics M4 Enigma is an Arduino Mega custom shield programmed to replicate the behavior of a German M4 Enigma machine. It consistes of 4 16-Segment units, 5 LEDs, 26 Lamps setup as keyboard, 26 keyboard buttons & 10 Function keys. The 115 light emitting diodes are multi-plexed. This minimizes the amount of pins needed to control them down to 38 pins and all 36 pushbuttons keys are sharing a total of 4 pins.

Installation Instructions

Depending on your type of kit, you need to install the relevant version of the code onto the Arduino:

Operation Instructions

To understand how to operate the S&T GeoTronics M4 Enigma, please refer to the following guide:

Release Notes

  • Designed, assembled & programmed by Marc Tessier & James Sanderson 20/9/13.
  • Modified for Prototype PCB pair on 4/12/13.
  • Modified to obey doublesteping and have M3 function 22/3/14.

openenigma's People

Contributors

markusschanta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openenigma's Issues

Not the latest code

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.

M3 reflector bug in "plugboard" code.

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

  • Reflector B = YRUHQSLDPXNGOKMIEBFZCWVJAT
  • Reflector C = FVPJIAOYEDRZXWGCTKUQSBNMHL

M4 with "thin" reflectors

  • Reflector B Thin = ENKQAUYWJICOPBLMDXZVFTHRGS
  • Reflector C Thin = RDOBJNTKVEHMLFCWZAXGYIPSUQ

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.

Improve README

  • Overview
  • Installation Instructions
  • Operating Instructions
  • Development Instructions
  • Links / Further Resources

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.