========= Enigmatic ========= --------------------------------------------- An emulator of the German WWII Enigma machine --------------------------------------------- :CreationDate: 2011-08-30 20:16:43 :Id: SW/Enigmatic :tags: - software - perl Why would you ever write one? ============================= During the `YAPC::EU 2011`_ dinner, people (not actually involved in the organisation of the event) started idly talking about what to put on the t-shirts for YAPC::EU 2012 in Frankfurt. Several very inappropriate suggestions were made, mostly involving WWII; at some point, the Enigma was mentioned, maybe because obfuscated Perl code does not look that much different from an encrypted message. Then I thought: I can quite probably write an Enigma emulator as a short obfuscated Perl program. So I started from a nicely-written, clean version, with the intention of compressing / obfuscating it later. This "nice" version is about 15KB of source code, 13KB of tests, and 4.5MB of dependencies (mostly Moose_, TryCatch_, autobox_) .. _`YAPC::EU 2011`: http://yapceurope.lv/ye2011/ .. _Moose: https://metacpan.org/release/Moose .. _TryCtach: https://metacpan.org/release/TryCatch .. _autobox: https://metacpan.org/release/autobox Resources and references ======================== Of course, I did not know enough about the actual workings of the Enigma: having seen a few, and having seen the Turing Bombe in operation, at `Bletchley Park`_, is not enough to write a proper emulator. After a relatively short search, I found three main sources: - `Technical Details of the Enigma Machine`_, written by someone who wrote an emulator - `The Enigma cipher machine`_ - `Enigma - a very famous story of cryptology`_ From these, I obtained just enough information to understand the mechanisms, and more importantly, the wiring of the various components. In addition, I found a `cyhpertext-plaintext pair`_ that I used to check that my emulator worked exactly as the real thing. .. _`Bletchley Park`: http://www.bletchleypark.org.uk/ .. _`Technical Details of the Enigma Machine`: http://users.telenet.be/d.rijmenants/en/enigmatech.htm .. _`The Enigma cipher machine`: http://www.codesandciphers.co.uk/enigma/ .. _`Enigma - a very famous story of cryptology`: http://www.mlb.co.jp/linux/science/genigma/enigma-referat/enigma-referat.html .. _`cyhpertext-plaintext pair`: http://users.telenet.be/d.rijmenants/en/m4project.htm