Remove hint.html and index.html
As per discussions on GitHub the index.html and hint.html files should be deleted in favour of README.md files (from any .text/.txt/.markdown/.md files which will be turned into README.md in an upcoming commit).
This commit is contained in:
1 parent
ee8a36310f
commit
77fb0f11a2
143 files changed
-28606
No files matched your search
@@ -1,771 +0,0 @@
|
||||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional //EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.2.2">
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=utf-8"> <link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css" />
|
||||
<title></title>
|
||||
<title>Most enigmatic</title>
|
||||
</head>
|
||||
<body>
|
||||
<CENTER>
|
||||
<IMG SRC="/png/ioccc.png" ALT="IOCCC" height=78 width=267>
|
||||
<P><FONT size="6"><I>The International Obfuscated C Code Contest</I></FONT></P>
|
||||
<div id="bar">
|
||||
<ul>
|
||||
<li><a href="../index.html">About the 27th IOCCC</a></li>
|
||||
<li><a href="../whowon.html">27th IOCCC Winners</a></li>
|
||||
<li><a href="/index.html">IOCCC home</a></li>
|
||||
<li><a href="/winners.html">List of All Winners</a></li>
|
||||
<li><a href="/judges.html">The Judges</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<P><FONT size="6"><B>A 27<sup>th</sup> IOCCC Winner</B></FONT></P>
|
||||
</CENTER>
|
||||
|
||||
|
||||
<h1>Most enigmatic</h1>
|
||||
|
||||
<p>Cody Boone Ferguson <a href="mailto:ioccc@xexyl.net">ioccc@xexyl.net</a><br/>
|
||||
<a href="https://ioccc.xexyl.net">https://ioccc.xexyl.net</a><br/>
|
||||
Twitter: @xexyl</p>
|
||||
|
||||
<p>The code for this entry can be found in <a href="prog.c">prog.c</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To use:</h3>
|
||||
|
||||
<pre><code>make
|
||||
./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code># IOCCC obfuscated!
|
||||
echo IOCCC | ./prog
|
||||
|
||||
# IOCCC obfuscated and de-obfuscated!
|
||||
echo IOCCC | ./prog | ./prog
|
||||
|
||||
# more input fun
|
||||
./prog - < try.this.txt 2>/dev/null
|
||||
|
||||
# more obfuscated fun
|
||||
echo testing test tests | ./recode
|
||||
echo testing test tests | ./recode | ./prog - 2>/dev/null
|
||||
echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode
|
||||
echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>This code is an enigma. Try to decode it!</p>
|
||||
|
||||
<p>There is a good deal of useful documentation that is provided with this entry:</p>
|
||||
|
||||
<ul>
|
||||
<li>enigma.1</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>A useful man page for this entry. To render, try:</p>
|
||||
|
||||
<pre><code>man ./enigma.1
|
||||
</code></pre>
|
||||
|
||||
<ul>
|
||||
<li>recode.markdown (<a href="recode.html">recode.html</a>)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Some useful information about recode.c</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="chocolate-cake.html">chocolate-cake.html</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Because most of us could use some <em>Double-layered Chocolate Fudge Cake</em>!</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<p>My remarks about my Heer ‘Army’ and Luftwaffe ‘Air Force’ Enigma simulator for
|
||||
the 27th IOCCC.</p>
|
||||
|
||||
<p>I want to dedicate this entry in part to the millions of poor souls that were
|
||||
lost during the tragedy that is the Second World War. There are so many people
|
||||
who are unknown, unloved, unclaimed and even unidentified. And who knows what
|
||||
they might have gone on to do if their lives weren’t - like it is with all other
|
||||
wars - needlessly taken from them? When one considers it was all because the
|
||||
most powerful man in the world at the time felt he should rule all others it
|
||||
makes it somehow even more tragic: there wasn’t even a good reason for the war
|
||||
(is there ever?).</p>
|
||||
|
||||
<p>If one were to write the name of every person who died in the conflict in a
|
||||
book, it would take so many pages that the book would be so heavy, so long, so
|
||||
expensive to print, and it wouldn’t bring anyone back to life nor would it
|
||||
erase the suffering. Nothing will. It’s horrible.</p>
|
||||
|
||||
<p>There really are no words that can truly describe the tragedy but I wish to with
|
||||
my Enigma simulator honour each and every soul who was lost, or suffered, or
|
||||
suffered the loss of friends or loved ones, as well as the world itself, in and
|
||||
from one of the greatest tragedies in the history of mankind.</p>
|
||||
|
||||
<p>I will have more information on this entry at
|
||||
<a href="https://ioccc.xexyl.net/2020/enigma">https://ioccc.xexyl.net/2020/enigma</a> after the winning entries have been
|
||||
published.</p>
|
||||
|
||||
<p><a name="toc"></a>
|
||||
- <a href="#ioccc">IOCCC: An Enigma?</a></p>
|
||||
|
||||
<ul>
|
||||
<li><p><a href="#nathan">The 1992 Nathan entry</a></p></li>
|
||||
<li><p><a href="#usage">Usage</a></p>
|
||||
|
||||
<ul>
|
||||
<li><a href="#example">An example run</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><p><a href="#recode">The recode.c configurator</a></p></li>
|
||||
<li><p><a href="#parsersubtlety">A parser subtlety that could cause confusion</a></p></li>
|
||||
<li><p><a href="#layout">On the source code layout</a></p></li>
|
||||
<li><p><a href="#obfuscation">Obfuscation</a></p></li>
|
||||
<li><p><a href="#bugs">Bugs, limitations, differences from the real Enigma machines and general notes</a></p></li>
|
||||
<li><p><a href="#kriegsmarine">Adding Kriegsmarine support</a></p></li>
|
||||
<li><p><a href="#portability">Portability</a></p></li>
|
||||
<li><p><a href="#winning">Winning thoughts, dedications and thanks</a></p></li>
|
||||
<li><p><a href="#resources">Resources</a></p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3><a name="ioccc" href="#toc">IOCCC: An Enigma?</a></h3>
|
||||
|
||||
<p>Is there a better single word that could describe the code that is IOCCC? I’m
|
||||
sure there are some other words that are equally as valid but I believe ‘Enigma’
|
||||
is a great word nonetheless.</p>
|
||||
|
||||
<p>However it’s curious that no winning entry has ever been a simulator of the
|
||||
German Enigma machine. I’m actually quite surprised at that because it’s such a
|
||||
brilliant piece of engineering of the time even though it had a critical flaw:
|
||||
that no letter could be itself; this combined with cribs (known or suspected
|
||||
plaintext) - which was down to carelessness, capturing an Enigma and sometimes
|
||||
settings sheet, as well as known messages the Germans started out with - allowed
|
||||
for cracking the code.</p>
|
||||
|
||||
<p>Combining this entry with two of the Morse code entries is particularly
|
||||
interesting because that’s what the Germans did: the party sending the message
|
||||
would first set up the machine, write down the letters and then transmit by
|
||||
Morse code the encoded message. Then those picking up on the message would note
|
||||
the Morse code, translate it to the alphabet and then input it into their Enigma
|
||||
machine configured in the same way and thus have the original message.</p>
|
||||
|
||||
<p>The <a href="/1998/dorsse/dorssel.hint">1998 ASCII / Morse code translator</a> entry (author Dorssel) prints the
|
||||
Morse code of text; and the <a href="/2014/vik/hint.text">2014 Morse audio transcoder</a> (author Vik) can be
|
||||
used to allow for the actual sound of it. With my entry we can complete the
|
||||
loop!</p>
|
||||
|
||||
<h3><a name="nathan" href="#toc">The 1992 Nathan entry</a></h3>
|
||||
|
||||
<p>The author (Nathan) of the <a href="/1992/nahan/nathan.hint">1992 Worst Abuse of the Rules</a> had this to say:</p>
|
||||
|
||||
<pre><code>This program is a hello world text encrypter/decrypter. It uses an
|
||||
enigma (I think) style encryption algorithm, where the encryption
|
||||
key character is modified by a value, determined from the previous
|
||||
character. Non-printable characters (those with ASCII values < ' '
|
||||
or > 0x7e) are passed unaltered, thus any kind of file may be
|
||||
successfully processed, but if the original is printable, the
|
||||
processed file will be too. The input is read from stdin, and the
|
||||
output presented to stdout. The key, a text string, is presented as
|
||||
a command argument. This is optional, and if omitted, the file is
|
||||
self-{de,en}crypted. To specify decryption, a "-" should be given
|
||||
before the key. (Actually encryption and decryption proper inverse
|
||||
operations, so you can use decrypt to scramble and encrypt to
|
||||
descramble, if you're perverse.)
|
||||
</code></pre>
|
||||
|
||||
<p>But the Enigma algorithm is more complex than that and my entry can encipher and
|
||||
decipher text in the manner of the Enigma machines of the Army (Heer) and Air
|
||||
Force (Luftwaffe); the Kriegsmarine ‘Navy’ was more complex (see section <a href="#kriegsmarine">Adding
|
||||
Kriegsmarine support</a> for more information on that.</p>
|
||||
|
||||
<p>My entry should also work as a non-military grade Enigma as it by default has an
|
||||
empty plugboard (they had none). I explain how to set up the simulator later.</p>
|
||||
|
||||
<p>Yusuke Endoh asked the judges and me if the real 1992 entry source was
|
||||
available. Simon Cooper didn’t have access to it because it was before his time in
|
||||
the IOCCC; but before the other judges could answer Ilya Kurdyukov sent a link to
|
||||
the original 1992 code. However because I do not know the current status of the
|
||||
regulation (though it seems unlikely that it still applies) I am only citing an
|
||||
old version of the IOCCC website:</p>
|
||||
|
||||
<pre><code> nathan - obfuscation by (trivial) encryption (source not exported)
|
||||
|
||||
Brian Westley decided to just ``screw the (US) government'' and make the real nathan.c source available. We also note that Nathan Sidwell who lives outside the US made his own source available as well.
|
||||
</code></pre>
|
||||
|
||||
<p>Anyone who wants to find it I am sure can but I leave that to them.</p>
|
||||
|
||||
<h3><a name="usage" href="#toc">Usage</a></h3>
|
||||
|
||||
<p>If you run the program by itself it’ll use the default settings and prompt you
|
||||
for input (end with EOF). At that point it’ll process the input string and print
|
||||
the result (after finishing the enciphering).</p>
|
||||
|
||||
<p>If you run it like:</p>
|
||||
|
||||
<pre><code> ./prog -
|
||||
</code></pre>
|
||||
|
||||
<p>It will prompt you for the settings of the machine (example below).</p>
|
||||
|
||||
<p>The first group is in the order of rotor (number), ring setting (letter) and
|
||||
ring (starting) position (letter). It will do this for the first, second and
|
||||
then third for each.</p>
|
||||
|
||||
<p>Then it will prompt you for the reflector (number). The first one is reflector B
|
||||
and the second is reflector C.</p>
|
||||
|
||||
<p>Finally it’ll prompt you for the plugboard pairs.</p>
|
||||
|
||||
<p>After that you can input the string and it’ll go from there.</p>
|
||||
|
||||
<h4><a name="example" href="#toc">An example run</a></h4>
|
||||
|
||||
<p>BTW: There’s a much more entertaining (and delicious) challenge or exercise in
|
||||
<a href="recode.markdown">recode.markdown</a> (involves <a href="chocolate-cake.html">chocolate-cake.html</a>). These however show
|
||||
the general program as well as how to use the two winning entries of the Morse
|
||||
code that I referred to earlier.</p>
|
||||
|
||||
<pre><code> $ ./prog -
|
||||
Ring 1: 3
|
||||
Setting 1: I
|
||||
Position 1: O
|
||||
Ring 2: 1
|
||||
Setting 2: C
|
||||
Position 2: C
|
||||
Ring 3: 5
|
||||
Setting 3: C
|
||||
Position 3: Z
|
||||
Reflector: 2
|
||||
Plugboard pair 1: CO
|
||||
Plugboard pair 2: DE
|
||||
Plugboard pair 3: SN
|
||||
Plugboard pair 4: XY
|
||||
Plugboard pair 5: MS
|
||||
Plugboard pair 6: AT
|
||||
Plugboard pair 7: VF
|
||||
Plugboard pair 8: UR
|
||||
Plugboard pair 9: KL
|
||||
Plugboard pair 10: BJ
|
||||
IOCCC
|
||||
^D
|
||||
CFDRG
|
||||
</code></pre>
|
||||
|
||||
<p>Notice that all output except the deciphered/enciphered text is sent to stdout.</p>
|
||||
|
||||
<p>If I didn’t specify the <code>-</code> by e.g. <code>echo IOCCC | ./prog</code> then it will use the
|
||||
default settings; as the judges suggest this invocation I will not show it here.</p>
|
||||
|
||||
<p>You can also type it out like this though:</p>
|
||||
|
||||
<pre><code> $ ./prog
|
||||
IOCCC
|
||||
UUMMX
|
||||
</code></pre>
|
||||
|
||||
<p>The IOCCC comes from stdin; the UUMMX is stdout.</p>
|
||||
|
||||
<p>If I compile the 2014 entry and copy it to my local directory as
|
||||
<code>vik</code> I might do:</p>
|
||||
|
||||
<pre><code> $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -
|
||||
</code></pre>
|
||||
|
||||
<p>And you would hear Morse code of the Enigma output of ‘TEST’ (i.e. KCWV). Or
|
||||
perhaps not in this case. I’m not sure: I discovered a bug in that entry
|
||||
(Fedora, CentOS and macOS all affected).</p>
|
||||
|
||||
<p>For example I can use the syntax provided in the winning remarks along with my
|
||||
entry to write it to a file. Say:</p>
|
||||
|
||||
<pre><code> $ echo TEST|./prog |./vik > test.raw
|
||||
$ ./vik e < test.raw | ./prog
|
||||
LEST
|
||||
</code></pre>
|
||||
|
||||
<p>Why did that happen? This shows more details:</p>
|
||||
|
||||
<pre><code> $ ./vik e < test.raw
|
||||
SCWV
|
||||
</code></pre>
|
||||
|
||||
<p>However as can be seen the first char is wrong:</p>
|
||||
|
||||
<pre><code> $ echo TEST|./prog
|
||||
KCWV
|
||||
</code></pre>
|
||||
|
||||
<p>And piping the original output to my entry itself you get the original input:</p>
|
||||
|
||||
<pre><code> $ echo TEST | ./prog | ./prog
|
||||
TEST
|
||||
</code></pre>
|
||||
|
||||
<p>I’m not sure what causes that or if there’s a way to fix it but that’s the
|
||||
idea anyway. Neither do I know if the original transcoding is correct.</p>
|
||||
|
||||
<p>What if I use the input string ‘LEST’ instead? In that case it worked fine:</p>
|
||||
|
||||
<pre><code> $ echo LEST | ./prog | ./vik > lest.raw
|
||||
$ ./vik e < lest.raw | ./prog
|
||||
LEST
|
||||
</code></pre>
|
||||
|
||||
<p>But there’s one obvious question, right? Let’s try the most important one:</p>
|
||||
|
||||
<pre><code> $ echo IOCCC | ./prog | ./vik > ioccc.raw
|
||||
$ ./vik e < ioccc.raw
|
||||
UUMMX
|
||||
$ ./vik e < ioccc.raw | ./prog
|
||||
IOCCC
|
||||
</code></pre>
|
||||
|
||||
<p>Phew! The program redeemed itself after the test failure! :)</p>
|
||||
|
||||
<p>(Technically above it didn’t print a newline after the output and this is how it
|
||||
is with some of the things I pasted in the other file and maybe others here
|
||||
too. Notice also how it showed the same output that my program gave it - UUMMX.)</p>
|
||||
|
||||
<p>What about the other Morse code entry?</p>
|
||||
|
||||
<pre><code> $ echo IOCCC | ./prog | ./dorssel
|
||||
..- ..- -- -- -..-
|
||||
</code></pre>
|
||||
|
||||
<h3><a name="recode" href="#toc">The recode.c configurator</a></h3>
|
||||
|
||||
<p>I have included a supplementary program ‘recode’ (<a href="recode.c">recode.c</a>) that can
|
||||
do a number of things which acts as a kind of wrapper and configurator to my
|
||||
entry. By default it prompts you for the settings (rotors/rings, ring settings,
|
||||
positions, reflector and plugboard pairs), validating input as you go.</p>
|
||||
|
||||
<p>After that it prompts for text that you can pass to the Enigma simulator;
|
||||
alternatively you can specify a file to read in.</p>
|
||||
|
||||
<p>It has a randomise mode and it can save/read the settings to/from a file to
|
||||
allow for duplicity (an archaic term for the state of being double but obviously
|
||||
for Enigma it has to also mean deceitful).</p>
|
||||
|
||||
<p>I recommend using this in a pipeline instead of the simulator itself if you want
|
||||
to change the configuration of the simulator because it offers a much richer
|
||||
experience (and because you can reuse the configuration without having to type
|
||||
it out again every time).</p>
|
||||
|
||||
<p>It does take the effort to try and prevent invalid input (as above) though maybe
|
||||
I didn’t think of everything. My entry was meant to be a simulator only as far
|
||||
as the ciphering goes but I thought this would make it much more interesting:
|
||||
make it more flexible by a wrapper program.</p>
|
||||
|
||||
<p>For examples using it (and a delicious challenge) see <a href="recode.markdown">recode.markdown</a>. See
|
||||
also <a href="recode.1">recode.1</a> and <a href="enigma.1">enigma.1</a> man pages.</p>
|
||||
|
||||
<h3><a name="parsersubtlety" href="#toc">A parser subtlety that could cause confusion</a></h3>
|
||||
|
||||
<p>The parser is in a sense rather rudimentary but allows for both interactive and
|
||||
automatic (e.g. via the recode program) input. This does mean that something
|
||||
like the following can happen:</p>
|
||||
|
||||
<pre><code> $ ./prog -
|
||||
Ring 1: 1AB
|
||||
Setting 1: Position 1: Ring 2: 2CD
|
||||
Setting 2: Position 2: Ring 3: 3
|
||||
Setting 3: A
|
||||
Position 3: B
|
||||
Reflector: 1A
|
||||
Plugboard pair 1: BC
|
||||
Plugboard pair 2: ..
|
||||
Plugboard pair 3: ..
|
||||
Plugboard pair 4: DE
|
||||
Plugboard pair 5: FG
|
||||
Plugboard pair 6: HI
|
||||
Plugboard pair 7: JK
|
||||
Plugboard pair 8: LM
|
||||
Plugboard pair 9: NO
|
||||
Plugboard pair 10: PQ
|
||||
IOCCC
|
||||
WD
|
||||
SIRDK
|
||||
</code></pre>
|
||||
|
||||
<p>First of all: what is that WD? I didn’t type that but it appeared it seems due
|
||||
to too much input that triggers this (it happens when I hit ctrl-d to end
|
||||
input).</p>
|
||||
|
||||
<p>If everything is input correctly it would show nothing except the actual Enigma
|
||||
output (maybe at times ^D - I have noticed this at least when I don’t fill in
|
||||
all plugboard pairs - which might or might not be possible with the Enigma
|
||||
machines that had plugboards, I really do not know). I don’t view this as a bug
|
||||
because the parsing of input is meant to be simple and in fact you can expect
|
||||
the same output from the same input even if there are errors in the input.</p>
|
||||
|
||||
<p>Anyway as you can see the first ‘1AB’ was the first ring, setting and position.
|
||||
After this it wants Ring 2 and I did similar; for ring 3 I did it each variable
|
||||
by itself. However for the reflector I did 1A and it only expects 1 char! So will
|
||||
that mean that the plugboard pairs are off? Yes it does seem to be so. This is
|
||||
buffering at play I believe but it’s useful for allowing the recode program to
|
||||
easily configure the Enigma machine. In the other markdown file I give a hint
|
||||
as to how this could be fixed but the caveat is it would necessitate a need for
|
||||
rewriting recode.c.</p>
|
||||
|
||||
<p>There’s another thing to be aware of and that’s the way the ranges are enforced.
|
||||
There are five rotors which obviously are in C 0-4 but in ‘natural language’
|
||||
1-5 (they were labelled I, II, III, IV and V though).</p>
|
||||
|
||||
<p>There are two reflectors and the same applies: in C 0-1 but in human it’s
|
||||
1-2 (technically these were reflectors B and C in the Enigma machine which I
|
||||
display by name in recode.c just like with the rotors).</p>
|
||||
|
||||
<p>For more information see <a href="recode.markdown">recode.markdown</a> or <a href="recode.html">recode.html</a>.</p>
|
||||
|
||||
<p>BTW: If you need a reminder to go to the gym just do your Enigma ABCs and it
|
||||
should help you remember (though not at this time in our world it might help you
|
||||
later on?). This might become even more useful after the challenge is accepted,
|
||||
accomplished and made use of! :)</p>
|
||||
|
||||
<pre><code> $ echo ABC | ./prog
|
||||
GYM
|
||||
$ echo ABC | ./prog | ./prog
|
||||
ABC
|
||||
</code></pre>
|
||||
|
||||
<h3><a name="layout" href="#toc">On the source code layout</a></h3>
|
||||
|
||||
<p>The layout of recode.c isn’t too significant (but see below) but I want to
|
||||
mention prog.c especially:</p>
|
||||
|
||||
<p>I did think of a more artistic layout but reflecting on it I think that the
|
||||
blankness of it can be another way of honouring all the many people who died
|
||||
in - like all other wars - what was a useless conflict because - again like all
|
||||
other wars - a powerful human being decided that they should rule others.</p>
|
||||
|
||||
<p>The blankness is a reflection of the millions of people who died unknown, uncared
|
||||
for, unloved, without ever being acknowledged in their far too short lives, some
|
||||
even unidentified; it’s the presence of absence.</p>
|
||||
|
||||
<p>I find it somehow fitting that the day I have finished this is 30 April 2020,
|
||||
which was exactly 75 years from the day that the person responsible for the
|
||||
Second World War, Adolf Hitler, ended his life. (I have since then made a bug
|
||||
fix but I consider this inconsequential).</p>
|
||||
|
||||
<p>As for recode.c though I really love this:</p>
|
||||
|
||||
<pre><code> /\
|
||||
/ This is *not* what you think:
|
||||
</code></pre>
|
||||
|
||||
<p>…because it seems so wrong in C code at first glance.</p>
|
||||
|
||||
<h3><a name="obfuscation" href="#toc">Obfuscation</a></h3>
|
||||
|
||||
<p>It’s an Enigma simulator! Isn’t that proof that it’s obfuscated itself?! :)
|
||||
Silliness aside <a href="obfuscation.txt">obfuscation.txt</a> has some of the ways I think this entry is
|
||||
obfuscated. To decipher try:</p>
|
||||
|
||||
<pre><code> ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.markdown
|
||||
</code></pre>
|
||||
|
||||
<p>To encipher:</p>
|
||||
|
||||
<pre><code> ./recode -Robfuscation.key -fobfuscation.markdown | ./prog - 2>/dev/null > obfuscation.txt
|
||||
</code></pre>
|
||||
|
||||
<p>The file <a href="obfuscation.key">obfuscation.key</a> is the key to decipher/encipher
|
||||
<a href="obfuscation.txt">obfuscation.txt</a>.</p>
|
||||
|
||||
<p>For the lazy <a href="obfuscation.markdown">obfuscation.markdown</a> has the deciphered version. I am afraid
|
||||
I’m not so inclined to do that for the cake recipe: the idea there is to make it
|
||||
a fun exercise that when solved unlocks a wonderful double-layered chocolate
|
||||
fudge cake recipe. But given that my ‘Don’t tread on me award’ entry also
|
||||
has the recipe, not enciphered, one might just go there instead. Still it’s a
|
||||
fun way to explore this entry.</p>
|
||||
|
||||
<p>As for the <a href="obfuscation.key">obfuscation.key</a> file if you observe the contents you’ll find the
|
||||
word OBFUSCATION:</p>
|
||||
|
||||
<pre><code> 2OB5FU1SC2ATIONCDEFGHJKLMPQRYZ
|
||||
OB FU SC ATION
|
||||
</code></pre>
|
||||
|
||||
<h3><a name="bugs" href="#toc">Bugs, limitations, differences from the real Enigma machines and general notes</a></h3>
|
||||
|
||||
<p>Ways that my simulator differs from the real thing. Not all of these are bugs
|
||||
and some could be considered features; others are just differences.</p>
|
||||
|
||||
<ul>
|
||||
<li><p>Does not check for using the same rotor more than once. The real Enigma
|
||||
machines this would not work because they had to choose from a set of rotors and
|
||||
there were no duplicates. This shouldn’t be a problem here however except that
|
||||
it won’t be a possible configuration of the real Enigma machine. The <code>recode</code>
|
||||
program <em>however does validate this</em> (except when reading in settings via the
|
||||
<code>-R</code> option which I explain in the <a href="recode.markdown">recode.markdown</a> / <a href="recode.html">recode.html</a> file).</p></li>
|
||||
<li><p>The way the plugboard - for the machines that had them - is if you connect A
|
||||
to B then no other letters can connect to A or B. Earlier there wasn’t proper
|
||||
detection and this caused invalid output.</p>
|
||||
|
||||
<p> Why only 10 pairs when the German alphabet has 26 letters? It’s
|
||||
theoretically possible to have 13 but the Enigma typically had 10 pairs.
|
||||
It’s easy enough to update my entry to do this once you de-obfuscate it but
|
||||
I’m not helping there (and in fact I don’t think I could any more even if I
|
||||
wanted to - at least not easily!).</p></li>
|
||||
<li><p>It does not obviously have the clicking sound associated with the moving
|
||||
parts of the real machine. I think it would be annoying to have this as it
|
||||
processes each letter. However with the Morse code audio transcoder entry you
|
||||
can at least have the output played in Morse code as the Germans did; I think
|
||||
that is really cool (I think it’s really cool even if there’s a bug in it)! That
|
||||
it pays homage to that (and another) entry is a bonus here.</p></li>
|
||||
<li><p>The simulator doesn’t report errors but tries to gracefully deal with them:
|
||||
if one chooses a value out of range it moves it into the range (if > the max
|
||||
then the max, if < min then the min). If invalid chars are input for the
|
||||
plugboard pairs then it’s not added to the plugboard etc.</p></li>
|
||||
<li><p>The real Enigma machines had only letters: no digits, no punctuation. My
|
||||
entry prints <code>!isalpha()</code> chars untouched. The Germans had different systems for
|
||||
punctuations, numbers etc. (one of the documents I link to has these details).</p></li>
|
||||
<li><p>My entry preserves case of letters. The real Enigma had only one case as it
|
||||
was just a keyboard and they didn’t need case-sensitivity.</p></li>
|
||||
<li><p>Later models introduced a fourth rotor. The Kriegsmarine procedures were
|
||||
also far more complex than the Heer and Luftwaffe. I find this particularly
|
||||
interesting because it was Hermann Goering who was the Supreme Commander of the
|
||||
Luftwaffe and the intelligence agency Forschungsamt (FA) was his; it provided
|
||||
Hitler with invaluable information so one would think the Luftwaffe system would
|
||||
be more complex! See <a href="#kriegsmarine">adding Kriegsmarine support</a> for more
|
||||
information.</p></li>
|
||||
<li><p>I only include reflectors B and C. To have included more would have used too
|
||||
many bytes (each reflector and rotor is 26 characters!) and I could not include
|
||||
them for this reason; I include 5 rotors and 2 reflectors and that’s a total of
|
||||
(<code>5 * 26 + 2 * 26</code> == 182 chars) but there are as you can see many other strings
|
||||
too. It is however feasible to update the rotor and reflector options and you
|
||||
could even make your own versions if you wanted to. Doing this is an exercise to
|
||||
the reader however (the idea of trying this makes me cringe because of how I
|
||||
obfuscated things)!</p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>There’s one thing I’m unsure of in my implementation. Because of all the
|
||||
possible settings I used some other simulators as a starting point and more
|
||||
importantly to validate that my code worked right. These other simulators had
|
||||
bugs though and so one thing looked odd and I don’t know if it is right or not.
|
||||
An online simulator appears correct but I don’t see the option to change that
|
||||
part.</p>
|
||||
|
||||
<p>If you notice in the Q() function where I set up specific pointers and other
|
||||
data there is a call to the macro ‘q’ but I only refer to the first ring setting
|
||||
(of which I no longer even know which element it is! Or was it position? I don’t
|
||||
even know that now for certain). That’s because the Python code did that (though
|
||||
very differently of course) but I also had to bug-fix the Python in another
|
||||
part.</p>
|
||||
|
||||
<p>I do not know if this is correct but as I show somewhere my entry does match the
|
||||
online simulator so I presume it is correct. It might be that the Germans tended
|
||||
to have it at A but again I do not know.</p>
|
||||
|
||||
<h3><a name="kriegsmarine" href="#toc">Adding Kriegsmarine support</a></h3>
|
||||
|
||||
<p>I said that one could add the additional rotors used by the Kriegsmarine but
|
||||
looking at this again it appears that it’s not as simple as adding the rotors to
|
||||
the code and updating the references to the array etc.</p>
|
||||
|
||||
<p>This is because rotors VI, VII and VII had two notches and this changes the way
|
||||
things work. The Kriegsmarine M4 also had an additional change which would
|
||||
complicate matters more.</p>
|
||||
|
||||
<p>I looked into trying to do this for another version after winning but some of
|
||||
the obfuscation techniques dramatically complicates even attempting this so I
|
||||
haven’t even tried.</p>
|
||||
|
||||
<p>It is feasible that you could add your own rotors however but I leave this as an
|
||||
exercise to the reader. I will say that the five rotors I, II, III, IV and V can
|
||||
be found in the source code verbatim and you could confirm it by looking them
|
||||
up; however much more would have to be done in order to get them to work, than
|
||||
to just put the strings in. Again the way I set things up complicates this
|
||||
greatly.</p>
|
||||
|
||||
<h3><a name="portability" href="#toc">Portability</a></h3>
|
||||
|
||||
<p>I have tested it under macOS, Fedora and CentOS Linux and all seems okay under
|
||||
these platforms. When I was in the final stages of obfuscation I made an error
|
||||
somehow (or else maybe the vim formatting caused a problem - I have seen this
|
||||
before) and I had to go back and undo some of the obfuscation to figure out what
|
||||
was going on (I had a hunch where and I noted it in the obfuscation I believe)
|
||||
but this made me wonder on if I made any other mistakes since it appeared to be
|
||||
working before that.</p>
|
||||
|
||||
<p>I don’t know if EBCDIC will work but I think it might because it appears that
|
||||
the alphabet is a contiguous sequence. I don’t believe endianness matters but I
|
||||
no longer remember what I’ve done in full and I’ve no way to test it.</p>
|
||||
|
||||
<p>If there are any inconsistencies in input/output one also has to be certain that
|
||||
input was put in correctly because as soon as a letter differs the entire
|
||||
sequence will be off.</p>
|
||||
|
||||
<p>The results of my test script (not included here but I will probably have it on
|
||||
my website) are the same under Fedora, CentOS and macOS.</p>
|
||||
|
||||
<h3><a name="resources" href="#toc">Resources</a></h3>
|
||||
|
||||
<h4>A note on Wehrmacht, its branches and other agencies and their Enigma machines</h4>
|
||||
|
||||
<p>The Wehrmacht was the defence force in full which included the Heer (army),
|
||||
Luftwaffe (air force) and Kriegsmarine (navy). As I said the Kriegsmarine
|
||||
procedures were more complex: they had additional rotors and one of their models
|
||||
had a different reflector system (thin instead of thick - some of the documents
|
||||
below discuss this). The military intelligence agency, the Abwehr, had their own
|
||||
system too. Non-military grade Enigma machines didn’t have the plugboard. And
|
||||
so on.</p>
|
||||
|
||||
<p>However one of the documents below distinguishes the Kriegsmarine from the
|
||||
Wehrmacht; when you see this you can read it as the Kriegsmarine versus the rest
|
||||
of the Wehrmacht rather than the Wehrmacht and the Kriegsmarine.</p>
|
||||
|
||||
<p><a href="http://users.telenet.be/d.rijmenants/en/enigmaproc.htm">Enigma Message Procedures</a>: The Heer, Luftwaffe and Kriegsmarine Enigma
|
||||
procedures.</p>
|
||||
|
||||
<p><a href="http://enigmaco.de/enigma/enigma.html">Interactive Enigma Machine</a>: Shows wiring of the Enigma machine based on the
|
||||
settings and input (unfortunately uses Flash). This was what I used to verify
|
||||
output (as best I could find). To set this up to use the default settings in my
|
||||
simulator make sure to use Rotors I, II and III and the starting positions at B,
|
||||
B and C respectively (as in left, centre, right). To do this click the button at
|
||||
the top right that looks like:</p>
|
||||
|
||||
<pre><code>o->
|
||||
<-o
|
||||
</code></pre>
|
||||
|
||||
<p>And then select the rotors. Next click the button again at the left of the
|
||||
rotor selection ‘screen’. Then use the arrow buttons above each rotor to set
|
||||
from left to right B, B and C. After this you can type your message in the input
|
||||
field and watch the wiring of the rotors change and show the path it takes.</p>
|
||||
|
||||
<p>If I made use of the Enigma code in the recode.c program I would maybe consider
|
||||
doing something like that but I intentionally do not use it there: as cool as it
|
||||
might be it would give a better idea of how the algorithm works (unless I were
|
||||
to make it just as obscure as I do in prog.c but that’s also a bit risky). I
|
||||
don’t believe I could do it now anyway.</p>
|
||||
|
||||
<p>I’m uncertain how to change the rotor settings itself in this simulator to
|
||||
determine if the ring settings being different from ABC would cause a problem
|
||||
(this is the thing I mention I’m uncertain about in the bugs section).</p>
|
||||
|
||||
<p>Going back to the configuring the online simulator try inputting the text IOCCC
|
||||
and you’ll see the resulting text being:</p>
|
||||
|
||||
<pre><code>UUMMX
|
||||
</code></pre>
|
||||
|
||||
<p>Which is exactly as my entry shows! So at least for the starting position BBC
|
||||
and an empty plugboard and the other defaults in my entry (which appear to be
|
||||
consistent with the online simulator too) I can verify it works.</p>
|
||||
|
||||
<p><a href="http://www.codesandciphers.co.uk/enigma/index.htm">Tony Sale’s pages on The Enigma cipher machine</a>: This is many pages on the
|
||||
Enigma machine by the late Tony Sale who was the original curator of the
|
||||
Bletchley Park Museum. There is a wealth of information in these pages on how
|
||||
the Enigma worked and this includes some challenges to do to see how well you
|
||||
understand the algorithm.</p>
|
||||
|
||||
<p>Fun fact: the abbreviation for the Signals Intelligence is that of our
|
||||
wonderful SIGINT.</p>
|
||||
|
||||
<p><a href="http://users.telenet.be/d.rijmenants/en/enigmatech.htm">Technical Details of the Enigma Machine</a>: ‘This page provides the technical
|
||||
details of the Wehrmacht and Luftwaffe Enigma, and the Kriegsmarine Enigma M4.’
|
||||
It is quite a nice document with diagrams, pictures of actual Enigma rotors and
|
||||
other parts and more.</p>
|
||||
|
||||
<p><a href="http://users.telenet.be/d.rijmenants/en/enigma.htm">The German Enigma Cipher Machine</a>: The history of Enigma, its development,
|
||||
use during the war and cryptanalysis.</p>
|
||||
|
||||
<p><a href="http://www.ellsbury.com/enigma3.htm">How the Enigma was Set Up and Operated</a>: This is the third page in a document
|
||||
series on the Enigma that explains the initial set up of the Enigma machine for
|
||||
each day. This is a good introduction to the set up. There is one thing that I
|
||||
was not aware of (or if I was it did not register): the operator would after
|
||||
setting the positions also put in three letters before the actual message (there
|
||||
were several parts to each message but this was another layer of complexity). I
|
||||
did not implement this in the recode program but what would it be anyway? If the
|
||||
user here wants to they could add three letters to their message beginning. I
|
||||
don’t think there need be any addition to the recode program - at least not
|
||||
that.</p>
|
||||
|
||||
<h2>Author’s dedication:</h2>
|
||||
|
||||
<h3><a name="winning" href="#toc">Winning thoughts, dedications and thanks</a></h3>
|
||||
|
||||
<p>Once again I’m honoured to win along with some of the other veterans who I have
|
||||
a huge amount of respect for; there’s Don Yang, Dave Burton, Yusuke Endoh and
|
||||
Edward Giles all of whom are amazing programmers. I’m especially proud to win
|
||||
besides Dave Burton and Yusuke Endoh but Don Yang and Edward Giles too.</p>
|
||||
|
||||
<p>But there are some others who I don’t remember like Ilya Kurdyukov (who’s
|
||||
offered a lot of interesting thoughts on Snake and who plans to have his own
|
||||
version after the entries are published), Nathan Otterness, Nicholas Carlini
|
||||
(whose entry is an absolutely brilliant abuse of printf - and I totally agree
|
||||
with the judges comments that your entry is so novel that it’ll be worth special
|
||||
mention in the future Best of IOCCC list!) and tsoj too.</p>
|
||||
|
||||
<p>Well done and congratulations to all of you again! Thank you for submitting the
|
||||
wonderful entries and I’m honoured to have my two entries beside yours!</p>
|
||||
|
||||
<p>To Yusuke Endoh, Dave Burton and Nicholas Carlini I very much appreciate your
|
||||
wonderful comments on this program. Your comments Yusuke on this entry specially
|
||||
and also Dave’s comments on my double-win are both extremely special to me - it
|
||||
truly takes my pride to another level!</p>
|
||||
|
||||
<p>I would like to dedicate this entry to my wonderful mum Dianne Ferguson whom I
|
||||
love with all my heart and soul <3 Thank you for being the best mother
|
||||
imaginable! You’ve been there for me in the darkest of my hours without question
|
||||
without complaint and with all the love, compassion, empathy, sympathy and
|
||||
devotion anyone could ever ask for. Bless you again and again and again dear
|
||||
mother.</p>
|
||||
|
||||
<p>I also want to dedicate this to Vicky Wilmore who has given me a lot of
|
||||
love the past few years and who was there for me in some very dark times. Thank
|
||||
you Vicky sweetheart from the bottom of my heart and soul. Although we have
|
||||
parted ways, whether for now or for ever, you will always always always have a
|
||||
place in my heart and soul xxx</p>
|
||||
|
||||
<p>Once more besides those two I want to also dedicate this to all the many
|
||||
millions of people whose lives were taken from them in what amounts to - like
|
||||
all other wars - a horrible, pointless conflict and an utter waste of life,
|
||||
something precious that is far too often taken for granted. As I noted before I
|
||||
found it fitting that I finished this on 30 April 2020 - exactly 75 years after
|
||||
Adolf Hitler, he who started the Second World War, ended his life. The blankness
|
||||
of the layout is another way of honouring the poor souls who lost their lives,
|
||||
many of whom we will never know even their name let alone what they might have
|
||||
accomplished if it wasn’t for their tragic and pointless deaths. Always remember
|
||||
that life is precious and never ever take it for granted! Believe in yourselves.
|
||||
Everyone. Do not let anyone ruin that for you ever.</p>
|
||||
|
||||
<p>I would like to thank my dear friend Martijn Schoemaker for encouraging me in my
|
||||
programming over the years and who I owe a great deal to. Thank you for
|
||||
believing in me and my programming abilities (and other abilities) even when I
|
||||
couldn’t believe in myself! Very much appreciated especially coming from an
|
||||
amazing programmer who I have huge admiration for!</p>
|
||||
|
||||
<p>Finally I want to thank Leo Broukhis, Simon Cooper and Landon Curt Noll for
|
||||
continuing to hold the contest after all these years - and for having selected
|
||||
my entries. It’s a huge honour; thank you! I also happen to love your comments
|
||||
as well as the award titles. And yes indeed ‘most of us could use
|
||||
<em><a href="chocolate-cake.html">Double-layered Chocolate Fudge Cake</a></em>!’</p>
|
||||
<BR>
|
||||
<HR>
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="/png/by-sa-3.0-88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2020,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user