build missing HTML files for entries

Setup a simple topnav for missing HTML files for entries.

Added `bin/gen-other-html.sh` to build entry HTML files from
markdown other than README.md to index.html HTML files.

Fixed duplicate link text in `2020/ferguson1/gameplay.md`.

Improved `inc/md2html.cfg` to support building the missing HTML
files for entries.

Added `make gen_other_html` to top level Makefile.
Added `make gen_other_html` to `make quick_www` and `make www`.

Fixed inventory links for year level index.html files.
Changed `bin/output-year-index.sh` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-02-27".

Added missing lines in `manifest.numbers`.  Update the affected
`.entry.json` files.

The manifest (in both `manifest.numbers` and the collection of
manifests from of all entry `.entry.json` files) now match.  Errors
from `make verify_entry_files` will now abort both `make quick_www`
and `make www` rules in the top level `Makefile`.

Changed markdown files in manifest to have an _inventory_order_ of
_2000000000_ so that the `index.html` file will usually appear at
the start of the _Secondary files_ set for the "#inventory" section
of an entry's `index.html` file.

Changed compressed tar files (files that end in _.tar.bz2_) in
manifest to have an _inventory_order_ of _100000_ so that these
files will usually appear at the end of the _Primary files_ set for
the "#inventory" section of an entry's `index.html` file.

Added 'Jump to top` link above the _Primary files_ section.
Changed `bin/output-index-inventory.sh` VERSION from "1.1.1 2024-02-23"
to "1.2 2024-02-27".

Updated HTML files to perform the above via `make www`.
This commit is contained in:
Landon Curt Noll committed 2024-02-27 22:36:20 -08:00
1 parent 7babf792e4
commit 9d3438fb88
718 files changed
+17515 -4084

No files matched your search

+34 -10
View File
@@ -9,14 +9,6 @@
{ "author_handle" : "Cody_Boone_Ferguson" }
],
"manifest" : [
{
"file_path" : "index.html",
"inventory_order" : 10,
"OK_to_edit" : false,
"display_as" : "html",
"display_via_github" : false,
"entry_text" : "entry home page"
},
{
"file_path" : "prog.c",
"inventory_order" : 20,
@@ -49,6 +41,14 @@
"display_via_github" : true,
"entry_text" : "original source"
},
{
"file_path" : "chocolate-cake.html",
"inventory_order" : 100,
"OK_to_edit" : true,
"display_as" : "html",
"display_via_github" : false,
"entry_text" : "encrypted chocolate cake recipe"
},
{
"file_path" : "input.txt",
"inventory_order" : 100,
@@ -57,6 +57,14 @@
"display_via_github" : true,
"entry_text" : "sample input"
},
{
"file_path" : "obfuscation.html",
"inventory_order" : 100,
"OK_to_edit" : true,
"display_as" : "html",
"display_via_github" : false,
"entry_text" : "about the obfuscation of this entry"
},
{
"file_path" : "obfuscation.txt",
"inventory_order" : 100,
@@ -73,6 +81,14 @@
"display_via_github" : true,
"entry_text" : "Enigma machine simulato source code"
},
{
"file_path" : "recode.html",
"inventory_order" : 100,
"OK_to_edit" : true,
"display_as" : "html",
"display_via_github" : false,
"entry_text" : "recode configurator documentation"
},
{
"file_path" : "try.alt.sh",
"inventory_order" : 100,
@@ -137,6 +153,14 @@
"display_via_github" : false,
"entry_text" : "download entry source"
},
{
"file_path" : "index.html",
"inventory_order" : 2000000000,
"OK_to_edit" : false,
"display_as" : "html",
"display_via_github" : false,
"entry_text" : "entry home page"
},
{
"file_path" : ".entry.json",
"inventory_order" : 4294967295,
@@ -183,7 +207,7 @@
"OK_to_edit" : true,
"display_as" : "markdown",
"display_via_github" : true,
"entry_text" : "markdown source for COMPILING.html"
"entry_text" : "markdown source for chocolate-cake.html"
},
{
"file_path" : "ioccc-cake.jpg",
@@ -207,7 +231,7 @@
"OK_to_edit" : true,
"display_as" : "markdown",
"display_via_github" : true,
"entry_text" : "markdown source for index.html"
"entry_text" : "markdown source for recode.html"
}
]
}
+335
View File
@@ -0,0 +1,335 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- The original markdown content was formed by the tool: bin/gen-other-html.sh -->
<!-- The HTML was converted from markdown by the tool: bin/md2html.sh -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>The International Obfuscated C Code Contest</title>
<meta name="description" content="chocolate-cake.md for 2020/ferguson2">
<meta name="keywords" content="IOCCC, 2020/ferguson2, chocolate-cake.md">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>chocolate-cake.md for 2020/ferguson2</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.up2index.html -->
<div class="topnav">
<a class="Left" href="index.html">&uarr; jump to index.html &uarr;</a>
</div>
<!-- END: this line ends content from: inc/topnav.up2index.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h1 id="blyzot-erhnfpm-tgbmmuykd-sczuo-mkwo">Blyzot-erhnfpm Tgbmmuykd
Sczuo Mkwo</h1>
<p>Fmjy’m u ejbtspawc uynzki-ydvutrn uycmtblxh pebvw rqoa nvnk tp
vqzcueaih gm sj cqo’f cdiiykyqer. Fx’q rufjwfpqzno skl N zxrqwg vtek
jwgh rlgxow ujo ataryp nm fcr zx osry gr owtm rn nao pwr cmk bm’w vtit
pzzcj yqs kkuwxm nm bmm gwyw jclesmfyi dwh mbal oun vrlb tpw
ggghownd.</p>
<p>Qk qvvr pclboqp yfq lzqw fztzk kqtix ‘pxrzgprnl’ ylbxo hyyt rjjo! Sdq
cmiygcx qotfb yg hzomk yk’q kggh xxln. Sbd nygpg <a
href="ucjei-lven.pzi">nsxeu-tppf.ctk</a> bea s lrdcss fhbnzks ch uowuqbp
<code>JUWPJ</code> cfwy xqo phxq axzblp gqozp, l impebytcy yoxt. Xkg
lwrarhk jyvns byg rigsb ajq oc ojgpyepc (14 Mwuplopu) hc 2022 zr jc’o
bls ptdz zjr Y tdzr:</p>
<figure>
<embed src="moxi.stc" />
<figcaption aria-hidden="true">aghllpv in kct Fajihs-bkmpoyk rgswgeimr
sxfah ofgk</figcaption>
</figure>
<p>Buhcv qvb zap clcw le vwmzqatokfu txu rigmaxhrvvrc; duw bhjk bwq zdz
qwfvm. Er vhuuuyey yjdew hom vrwm <strong>UMLW EDOMAUQLC XTSAO</strong>
oa ful jozfwdrus nc; oikl ywtr cu mnkmvoro cqkoakn yzrt’xa
<strong>PMINGEM PTOFGCPLN</strong> ihk atp xksdtxv yw ggt rnwk. Fjtp
uttbhy ui ltketccabj.</p>
<p>Vaqhz X texd qmdummxg cix gqmnuwnjxil juojuiriqt psl J uukfprr vigk
esjxsj oad fhvvhmtbaqdk xh uwcs etm kr ocnt. Ueee ue ezib fsl bpzt lg
bwz tbsvbvx ljeio.</p>
<p>Wrxqsdv plys didm gfbmmjdqp rh kgkzu zub jzo nj soj hfefe yewd ofsqe
kzd djve cs jrv eqdycb gqjkbz fd djg dzzy gcc vcs pkl upqgs tj
hndlmzqyse.</p>
<h2 id="fydmeefakhdr">Fydmeefakhdr</h2>
<p>Bjcq owe kqfxcfimql cwhdd qpcp oj Vabbgrkr sumyxpun jrk hilou lg lux
eatbiczhtfko gxr bs vay XG mashqmcvx. Y bbft mrtxslqd (olxl lcf jtyq
ngsi frzm xhlr twmlnhe) dq
&lt;nvrt://vbx.dtfevjdzqjrhcarz.wyy/fthcjau.kqy&gt;. Groi vcxy
iivwmmosboxq nhldua qef mazo, iryihyvew, hoejcczsdqx irh kvmavj.</p>
<h2 id="diwuam-blnnhvxhq">Diwua’m blnnhvxhq</h2>
<p>Jtmxt’t xauphebaf la y ompso hzsw kwf ztc ovvcees eo wrkbgmyc pb
wriamhhqhlk bdtgtnbsn kgzc ptjx tiy novwfy. Segyofxtw na p [wwrnzuvcuj
SYO][] gb oqndz wv kstodh cahbovqdw zlgxsr:</p>
<blockquote>
<p>Umiwkh qmvecmimt ssdjkzgq zs rgvln rfp up fxwut jgigfc ‘kwwicrngdhh’
nb ‘mqinqz’ ofvycfnbw. Ea uhpp yghevmfon sa’h vkhpfc 100% fffsa bqdnv
he’k kfxuvabh rakj pa cbqjzn te gevio ivfit, tow qpxnnkc qkuc.</p>
</blockquote>
<p>Zfr TGA lgoupgpq csxw mzj fknie gchf wr zdbm huc b fwfdpx jbvzow pbkf
tts C vswagx sslnn nfn hgtrawqu hndrey fvsqk fcqh ci’y spbnyhufppq
muvoddwqd jmzy zdz psyhob. Qeh YMD bxsyp jtiio gdcy zwqsd bziq
pnxycxjmzpl elp C sjjo bz gfqs xtqj slii tvetk sizq qly pe; Y bmzunqy
mletnlo mz kkmxza’h eh ifdz.</p>
<p>Cksoax nwe <strong>SMTEXS OLXVT YQJ BDHLSVZIM WF SOC UVJ CNZDN et umz
kgsgmxujj UG OZG EXUGWO ufw MYBAJB LAVQU GFPLKGC CUTF’FQ <em>IOVXVXQOK
KIFRJRZTP!</em></strong></p>
<h2 id="jeveget-lncfe-hix-amh-djlx">Jeveget lncfe hix amh djlx</h2>
<p><strong>BMM MISRS BJXXUQLBK FA NTBGX:</strong></p>
<ul>
<li><p><strong>XXA <em>QGHBNTBVK</em>! BH <em>LRX</em> MAZ
ZGDSMI!</strong> Jwafgu ykda hfr cgff srmw. Rj vzi yxyei vd xbpt hcqm
mnx mumfhz wn qpawr oiwfly fjp’gx tiyf qylmujtx; cb vtsv tfbd xsz jfjjg!
Uswgaj euiv fenu cnyg mhuemf jj irbb’d tabv emj mzqu yur rdxx fku qnmun
zv eulo kiqs ikovrp ri tsvnmmmeb. Hznx aec bcgc sevjpz asyrcpb xyyx
‘twep xbfrio’ zcj sxsx qmbf prlz iepkv qpq af ez vgz ezs gcfy gia
hkgxsq.</p></li>
<li><p>Jpbu sgx jlitg ikwl mioefrv egv zoil ps eqf drxryonrfka etwpnbfzb
qhvgpwt; detu bwwz nz mo isl cyjwl bnuw; lnm ogxf vqj 1/4 zflkm yeyc
xbxixy tw cg qbsi sp vvjaonsm fwim <strong>BSJ EAHXAV FU NF SDSWV
<em>DFM TKFQUHJ</em> RM ZAAVDK</strong>. Rlr isp vtzntmndtzpv cusl pp
ewdkv’g nwu uhihp.</p></li>
<li><p>Jwz ooxjwqt cdltmixjm sp avk <strong>FAAS ACX PKIC DKZ SFURBLEYS
RKPX</strong> iqsx. Afxb cvjf sr aciy zjze bmjjr x dnc ktreau tjs ftetp
vgdk by pizxzy bsx vlckyz u etv. Yeqv qb hczrit jtg alkm tk xmp qxdx
owujg dfy x dddphl zvc mpa.</p></li>
<li><p><strong>YKREKJ ZAZ SHYT VMRI XID WREW <em>2 RAIIAPH QQCPX
HTNFHPOJ PQWL SDMU</em></strong> srv nyip kuchp ic <strong>IPVSL FMZB
<em>CS PIJDF!</em></strong> Ypq vubxnengj kzwja uv gz <strong>WSCJ ZEJZ
RUZL BAAT <em>FCA’O RXHVJZQL</em></strong>.</p></li>
<li><p>Pndo udv kkhpba cvj klegy ogsgmhl awmz wgvn rplanlua djtqc te f
eyu; hnr gx’i pqetlodderczv nzjev ca s zol. Ge bte mcfaaqfcmeax uekj nyl
nydehc bge amezj sivf 4 omty txrzw fufmr scwoq.</p></li>
<li><p><strong>CBU <em>UVCBM YNCR!</em></strong> Rdg’x fgz tghh ispx xi
xgjcgdjn osl uzcy cc rpx blmy gag jdfg.</p></li>
<li><p>Fqr <strong>XFVM <em>LHDH</em> RQLACVJ PVBWPMV!</strong>
<strong>GR <em>PTL ZOF GJWBVOTUH BOEASEQ!</em></strong> Zbz slzfdbdvk
vjko ohpg rauk phez be w ppevc fcpbuem.</p></li>
</ul>
<h2 id="mhaq-tbwhtqpayzx">Mhaq Tbwhtqpayzx</h2>
<ul>
<li>3 no xovjudihzxw (Sqwnw’q) uoavvhzbq</li>
<li>2 gha 1/4 madf nfqza</li>
<li>2 yjpa azagtv mdtt</li>
<li>1/2 qab jeio</li>
<li>2 xqc 1/4 dwho supjxa evufg pryge</li>
<li>3 wcrc</li>
<li>1 jma 1/2 wim <strong>JTVQ HLKEGCE SDVZMSS (<em>CIX QXMWCOPHH
NFYSARC!</em>)</strong></li>
<li>1/2 unl <strong>YTVMXUZVU (<em>IPY AXNUQL!</em>)</strong></li>
<li>1 svd (lepmtxq) yddvt</li>
<li>1 qbq wikb jzkzg</li>
</ul>
<h2 id="srgk-hpqxbulqtwy">Srgk Hpqxbulqtwy</h2>
<ol type="1">
<li><p>Rwvllzf dymgzp <strong>AOM 9 o 1.5 SAWO UZTVS FPBN</strong>;
dylwhju zpvc twag dvgcf.</p></li>
<li><p>Jxfvlxq vnre ht <strong>350 J / 176.67 F</strong>.</p></li>
</ol>
<h2 id="eqvj-enosawdjxq">Eqvj Enosawdjxq</h2>
<ol type="1">
<li><p>Qvxx <strong>3 IH ERAZZALRVRT DFDKSHYGM</strong> cu fwsnet ziwopo
zx usuxu rkne rxwa <strong>uxx (<em>GEB THJ FJKXNLU</em>)
grzvm</strong>; wyy ycgm kldvlc nmyiuhczmf.</p></li>
<li><p>Mxyz <strong>2 kdv 1/4 RVGV KWGQF</strong>, <strong>2 PTQ NSRBCW
XUEI</strong>, tmj <strong>1/2 MWA XIHI</strong></p></li>
<li><p>Cuko <strong>1 LBJGV EQIUKDFEH (<em>HAO DZBJIN!</em>)</strong> am
ceivw ijbb <em>xhfdg cjkc</em>. Ghkwx <strong>XEWLKDZFW, <em>OLY
QEBCYZ!</em></strong></p></li>
<li><p>Des <strong>2 wki 1/4 XSFV HJYGUO CHYEB TEMDM</strong> qxt
<strong>3 TFRA</strong>. Esfk cadkr xvsrq zov avwopx.</p></li>
<li><p>Iwjf os <strong>1 1/2 YMH <em>LOEJ</em> XRUOHPO MMDXCOE (<em>MGV
XASVIPNIV PSYDGXH!</em>)</strong> bcn <strong><em>QVEFTM</em> KHSIYI
VXBZZTTKP</strong>.</p></li>
<li><p>Csxo fc bxu jlspzumxvcf kmwodfkxtkx jtvy <strong>1 KXF AMRD
DDDLF</strong>; pxlddn yukh ypapm dpaafr.</p></li>
<li><p>Aoqj qz <strong>1 KIM <em>CRWCWJC</em> RWNTW</strong>.</p></li>
<li><p>Cube qkar hmjmrwob ajlw.</p></li>
<li><p>Ordp wzk <strong>ETVS 35 HCYRLCV</strong> (<strong>KD
SYFNQY!</strong>) uc <strong>350 W / 176.67 D</strong>.</p></li>
<li><p>Zkkp ius dhja kjw fzmg pqu jmx ojd kgbv fpde af n tfzbkyi tvvh
mia **_SQQN LMY SBXJCQA IEY GNOE <em>WFXHMCWXSSL WWZM XHOSY FJW TY GX
HNWM</em><strong>. Wwn </strong>OLJC <em>USBYUCPUXS!</em>**</p></li>
</ol>
<h2 id="kjted-efcqnplspdo">Kjted Efcqnplspdo</h2>
<ul>
<li>4 bc lfpjwafstfc btthlwwis (Skrvb’h nthtyxkxo)</li>
<li>1/2 dlg <strong>ATXQRITQP (<em>YCD PEGGGJ!</em>)</strong></li>
<li>4 xhnl cypelpkc jgwxc</li>
<li>1/2 tfe pufjy rotw</li>
<li>2 kls <strong><em>MNCS</em> ZPAWTOW LSDKTSL (<em>VRN VXFCHNNMJ
SXKTWIF!</em>)</strong></li>
</ul>
<p>Rem bdku dzpm vyuw n gvyxqs gkb ve kbyc hbxj dvr vkqb lpg rubqo susl
syw dbmqj qfht omj vfs rx.</p>
<h2 id="nhchqms-jsivn-hhx-qjv-zxzca">Nhchqms jsivn hhx qjv zxzca</h2>
<p><strong>FIO KICKH NCSGMJBRP HW LMFYH:</strong></p>
<ul>
<li><p><strong>OKRA IVBF</strong> owzl yna jwohls upchbknmo bkm
<strong>YGZZDYSKZ (<em>UNS YYYORJ!</em>)</strong> ii qyk cij
crbxw.</p></li>
<li><p>Irc qvbw #4 eqn <strong>8 cn 10 RRH FLSUO</strong> hj s dck ex
dyx mnjj (cxtx’i cqm xiivap ntnk zgewbli wbta pvr wti cd fz).
<strong>YVH TC BFQY ZM PSWUX</strong> zvy <strong>CDC WXK IUOW MAAJ ETR
WDEOP QV EVQ URO AF ESVC</strong> dd fwg yhuit. <strong>RM MFF COS ELB
GVZCL PPM IRA!</strong></p></li>
<li><p><strong>BC KNZ FMU NVZEZ XFQ YXG EOYUB.</strong></p></li>
<li><p><strong>DNI <em>FPTBF NTEL!</em></strong> Arp’j hzn lfuj jhnx wd
adnytarh sov qfuo xp tuu eypo bgk zdmt.</p></li>
<li><p>Zdw <strong>RMDK OFCR LEALWTC DHXXWIN</strong>! <strong>NM ZRP
OIM QRMQQRGFQ JKJYGEJ!</strong> Wfm qztrqlotv ivvv tsrg rkgu ddot br u
uhxyw rjxvhtd. Em Q ekjcko aii ozoto gvu mzggj x zuq muszi (xwu npjdx
pzmesrpuw qb fuwpr) unu htpgx ul gtb lsyoygbsi tqpvkkl (mnrxib fpipbgx
kf wlgper’r xxc eccg jrkgwdy ca isi vgji ma zitksw nv). Ytqs bfq’s rl
qo.</p></li>
</ul>
<h2 id="murew-ohoodwphiu">Murew Ohoodwphiu</h2>
<ol type="1">
<li><p>Vmwtwlf <strong>4 IK QVQJMGVORKA UAKNDZTCP</strong> lsj
<strong>1/2 RPO <em>LGIRLIFJD (OTK XQEJUF!)</em></strong> zc fzp. Ocfm
rgr jgrqkl ymhy nspp. <strong>FT GFX VXV SY SSO HPSQE!</strong></p></li>
<li><p>Xhvunaw <strong>3 1/4 HNZJ RLQNCLPV KHCHX</strong>, <strong>1/2
QNFU BJCGF ASBH</strong> dyw <strong>2 FPA </strong><em>ZGXF</em>
PVXXWWQ RAEZEEC (<em>QCE UYOHRHVQD DVEUWNP!</em>)** stpn l njmv.
<strong>YNMC PMMJD DXNZMJ</strong>.</p></li>
<li><p>Vfs mrbmrtzsm qnoxsux.</p></li>
<li><p>Isu yapu nd iij/fyqc sj jur rvz jdfaa. Gvdh hnrj jqrfj/krztm
nwuzg ca’m efxhj FPY iyl qmi cvdpx. <strong>Ysxn <em>VZTL</em> KFEAT
QAWE <em>DZH</em> ZDO FXY!</strong> Qfw aeqm jo al <strong>UUIJ YXJ MDKH
JE’W BW QVVR <em>CPD AW IWS WQY HOR HMPGW CMZ
LTF!</em></strong></p></li>
</ol>
<table>
<colgroup>
<col style="width: 100%" />
</colgroup>
<tbody>
<tr class="odd">
<td>(q) Beqmpxdco 1984-2020, [Mlp Xmzzsgng, Ypgqh Edmmnc, Dvrmer Mzva
Hpwr][yrotjo] - Ivr beoqgu lyxytxxt Fwvv qmjv ld svkqxrlh aibco d
[Lzyelscr Jaonjqx Engmwcsrknd-RwponJkktx 3.0 Jrdllayi Glnwmvc][py].</td>
</tr>
<tr class="even">
<td>[mbwvfy]: xfeog://vcp.nihxr.bpx/ylvnhd.dnvh [sw]:
vgfc://gnwnxoisovojzby.dhl/tndtbatn/wh-bb/3.0/</td>
</tr>
</tbody>
</table>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=#">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+10 -3
View File
@@ -965,9 +965,9 @@ https://creativecommons.org/licenses/by-sa/4.0/</p>
<h1 id="inventory-for-2020ferguson2"><a name="inventory"></a>Inventory
for 2020/ferguson2</h1>
<p><a href="#top">Jump to top</a></p>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/prog.c">prog.c</a>
- entry source</li>
@@ -980,15 +980,21 @@ href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/pr
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/prog.orig.c">prog.orig.c</a>
- original source</li>
<li><a href="chocolate-cake.html">chocolate-cake.html</a> - encrypted
chocolate cake recipe</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/input.txt">input.txt</a>
- sample input</li>
<li><a href="obfuscation.html">obfuscation.html</a> - about the
obfuscation of this entry</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/obfuscation.txt">obfuscation.txt</a>
- sample input</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/recode.c">recode.c</a>
- Enigma machine simulato source code</li>
<li><a href="recode.html">recode.html</a> - recode configurator
documentation</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/try.alt.sh">try.alt.sh</a>
- how to run alternative code</li>
@@ -1015,6 +1021,7 @@ download entry source</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="index.html">index.html</a> - entry home page</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/.entry.json">.entry.json</a>
- description of entry in JSON</li>
@@ -1028,7 +1035,7 @@ href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/RE
<li><a href="cake.jpg">cake.jpg</a> - image for chocolate cake</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/chocolate-cake.md">chocolate-cake.md</a>
- markdown source for COMPILING.html</li>
- markdown source for chocolate-cake.html</li>
<li><a href="ioccc-cake.jpg">ioccc-cake.jpg</a> - image for chocolate
cake</li>
<li><a
@@ -1036,7 +1043,7 @@ href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/ob
- markdown source for obfuscation.html</li>
<li><a
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/recode.md">recode.md</a>
- markdown source for index.html</li>
- markdown source for recode.html</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
+371
View File
@@ -0,0 +1,371 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- The original markdown content was formed by the tool: bin/gen-other-html.sh -->
<!-- The HTML was converted from markdown by the tool: bin/md2html.sh -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>The International Obfuscated C Code Contest</title>
<meta name="description" content="obfuscation.md for 2020/ferguson2">
<meta name="keywords" content="IOCCC, 2020/ferguson2, obfuscation.md">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>obfuscation.md for 2020/ferguson2</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.up2index.html -->
<div class="topnav">
<a class="Left" href="index.html">&uarr; jump to index.html &uarr;</a>
</div>
<!-- END: this line ends content from: inc/topnav.up2index.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h1 id="obfuscation">Obfuscation</h1>
<ul>
<li><p>Strings identifying what it is are encrypted by the Enigma itself
(with its default settings). The strings are: <code>Position</code>,
<code>Setting</code>, <code>Ring</code>, <code>Plugboard pair</code>
<code>Reflector</code>. Together these would be a dead giveaway to
anyone familiar with the Enigma machine and some of them by themselves
would be a dead giveaway too. I can’t even explain how I did this
(although I’m sure at one point I could have) but I do think it’s pretty
cool to have the text encrypted by the program and still be capable of
printing it correctly all without giving anything away.</p></li>
<li><p>Digraphs. This isn’t necessarily obfuscation itself but it does
cause some beautifiers problems and it can be useful in layout as well
(in some contexts there is an aesthetic appeal to my eyes too).</p></li>
<li><p>Compound literal of ints of size 13 that have a variety of
different data (including what was originally two arrays plus some
additional ints).</p></li>
<li><p>Negative pointer offsets. This include calculated offsets into
the huge Y&lt;:19:&gt;&lt;:27:&gt; but it’s not the only example. Here
the compound literal of 13 ints:</p>
<pre><code>int *z=(int[13]) { 0 } , *e, *g;</code></pre>
<p>Then in main:</p>
<pre><code>e = z + 10;
g = e + 1;
for (j=-3; j &lt; 0; ++j)
e&lt;:j:&gt; = j+3;</code></pre>
<p>Which I think is more confusing: when one is iterating an array you
don’t expect to start out with index &lt; 0 but to then compare that
that index &lt; 0 and increment until 0 along with setting the value of
the array to j + 3 is more confusing still. There are at least two other
ways that are much easier to read that could accomplish the same thing.
It continues on:</p>
<pre><code>/* ... */
e&lt;:i-3:&gt; = (j &lt; 1 ? 1 : (j &gt; 5 ? 5 : j))-1;</code></pre></li>
<li><p>Observe these two functions:</p>
<pre><code>void w(char *s, int k, int v)
{
for(e&lt;:2:&gt; = 0; s&lt;:*P:&gt;; ++e&lt;:2:&gt;)
{
v = s&lt;:e&lt;:2:&gt;:&gt;;
if(v &gt; 64 &amp;&amp; v &lt; 91)
s&lt;:e&lt;:2:&gt;:&gt; = (((v - 65 + k) % 26) + 65);
}
}
void Q(void)
{
for(*g = 0; *g &lt; 3; ++*g)
{
*Y&lt;:16+e&lt;:1:&gt;:&gt;=S&lt;:e&lt;:e&lt;:1:&gt;-3:&gt;:&gt;;
R&lt;:e&lt;:1:&gt;:&gt;=Y&lt;:e&lt;:-3+e&lt;:1:&gt;:&gt;:&gt;;
w(R[*g],*(e+e&lt;:1:&gt;-6)=q(Y&lt;:8:&gt;,*Y&lt;:7:&gt;),*g);
}
}</code></pre>
<p>First of all: why do I set <code>e[2]</code> to 0 and increment it
for each pass in the loop, but then the condition for the loop is
<code>s[*P]</code>?</p>
<p>Second notice the many references to e[1] (as e[1] and <em>g). This
variable (pointing into z) is used as the iterator in this loop as well
as a loop in another function. Now why do I pass </em>g to the function
w()? To mislead. Originally it was more misleading in that I didn’t
touch the parameter ‘v’ in the function and did a *g = v; at the end of
the function. But even though I did not actually change the value I did
not know if this would cause a problem with sequencing so I decided to
remove that part and simply use the v parameter as a temporary variable
but one that started out as the current iterator of the loop in the Q()
function (but since not a pointer it’s not modified).</p>
<p>Originally I went further than that but due to order of evaluation
being unspecified I changed it to what it is now. Anyway:</p>
<p>You can also see that I use the value of e[1]-3 as the index of S[e]
(so S[e[e[1]-3]]) (I think I said that right; I honestly don’t know now
because there is such major array and offset abuse. The entire prog.c is
riddled with offset abuses.).</p></li>
<li><p>If you observe that above the compound literal <code>z</code> is
of size 13 but I point <code>e</code> to be <code>z + 10</code>. Why?
Twofold: (1) I decided to make use of one of them as a temporary
variable instead of a regular int in the function (so make it global);
and (2) I didn’t want to risk changing all the offsets: thus I just made
that address <code>e[1]</code>. Thus I also have:</p>
<pre><code>for (*g = 0 ; *g &lt; 10; ++*g)
{
r&lt;:-2:&gt; = Y&lt;:14:&gt;&lt;:*(e+1):&gt;; r&lt;:-3:&gt; = Y&lt;:15:&gt;&lt;:1&lt;:e:&gt;:&gt;;
if (r&lt;:-3:&gt; &amp;&amp; r&lt;:-2:&gt; == r&lt;:-1:&gt;)
return r&lt;:-3:&gt;;
if (r&lt;:-2:&gt; &amp;&amp; r&lt;:-3:&gt; == r&lt;:-1:&gt;)
return r&lt;:-2:&gt;;
}</code></pre>
<p>This <code>e[1]</code> of course is the same as <code>*g</code> as
above and as you can see has multiple dimensions (that is the reference
to Y does) too (and this is also strewn about the code). In the above
I’m referring to the variable in more than one way: *g for the iteration
but also e[1] for the actual element of both Y[14] and Y[15]. I also
happen to use S (via r which points to S + 10) which I use as the two
chars to compare (this is the plugboard function).</p></li>
<li><p>The above function Z() takes a <code>char x</code> but you won’t
notice it being used at all. Why? In fact I call it like so:</p>
<pre><code>k = Z(r&lt;:-1:&gt;=k);</code></pre>
<p>The char is just used as a way to be able to call the function and
assign to the proper variable at the same time: in the function Z I
don’t care about x because it’s the same value as r[-1] (which I do care
about). Why is it attached to S? Because it conveniently is already set
up to point some ways in that array, the rest isn’t used and by having r
going past S I could use again negative offsets to cause more
confusion.</p></li>
<li><p>Although this is clearly already shown in the above there are
other ways I refer to the same variable in more than one way (or in some
cases maybe more correct to say ‘same location’). In the Z() function
for example:</p>
<pre><code>r&lt;:-2:&gt; = Y&lt;:14:&gt;&lt;:*(e+1):&gt;; r&lt;:-3:&gt; = Y&lt;:15:&gt;&lt;:1&lt;:e:&gt;:&gt;;</code></pre>
<p>I refer to e[1] as both: *(e+1) and 1[e].</p></li>
<li><p>Replacing a number of <code>if ..</code>s with
<code>... &amp;&amp; (...)</code>s (in one case at least it’s nested
further:
<code>f &amp;&amp; (f = 0 &amp;&amp; (a = W(A,a)));</code>).</p></li>
<li><p>Three different char arrays in one: the rotors settings, the
positions and the notches for each rotor. The first two are interleaved:
I have the 0th element of each next to each other, then the 1th element
next to each other then the 2th element next to each other. Then it’s
the notch settings. The first two arrays here require some index
calculations like <code>i+i%3</code> and <code>i+i+1</code> depending on
which ‘array’ is needed. At other points I refer to those elements by
direct index (sort of).</p></li>
<li><p>Another set of char arrays in one: the five rotors as well as the
two reflectors in one <code>char [][27]</code>. This makes for some fun
code like:</p>
<pre><code>(Y&lt;:e&lt;:-10:&gt;+5:&gt;&lt;:k-&#39;A&#39;:&gt;) &amp;&amp; (k = Y&lt;:e&lt;:-10:&gt;+5:&gt;&lt;:k-&#39;A&#39;:&gt;);</code></pre>
<p>(Of course this also removes an if statement by joining with a
&amp;&amp;).</p></li>
<li><p>In fact I decided that the above two arrays in arrays needed to
be merged with the rest of the char arrays so that’s what I have done.
They have different purposes and they’re referred to differently. I will
cite next the remaining arrays in the next items (but not necessarily in
the correct order). Notice that the array I’m talking about is the
massive <code>Y&lt;:19:&gt;&lt;:27:&gt;</code>.</p></li>
<li><p>The alphabet (this is one string).</p></li>
<li><p>The plugboard (this is two arrays).</p></li>
<li><p>The Enigma ciphered text for prompting for input (five
strings).</p></li>
<li><p>The relevant notches (this is not the same as the five notch
letters!) (this is three chars but each in a different element of the
<code>char Y[19][27]</code> - for why see below).</p></li>
<li><p>I’m not even sure if there are any others due to the way I have
done this; to save iocccsize bytes I have used the first element of
three of the strings when I only did need the first element (since doing
e.g. <code>f[3][2]</code> takes more bytes than <code>*f[3]</code> or
whatever). All in all though there are 18 different strings (in some
cases only the first char is relevant) in <code>char Y[19][27]</code>
with a multitude of different uses. Some of these are as I noted
scrambled. Some default to empty string which might hide that it’s even
there.</p></li>
<li><p>Although minor I have made use of the result of the end of a for
loop in the beginning in the next loop in main(): <code>j</code> will
end up being 0 and I need it at 9 so I do <code>j += 9</code> in the
initialisation of the for loop instead of simply setting it to
9.</p></li>
<li><p>The judges don’t like obfuscation through the C preprocessor.
That’s fair enough because as they rightly point out they can just use
the C preprocessor itself. But although I have quite a few cpp
directives I am not using them for obfuscation but rather to save bytes.
For examples:</p>
<pre><code>%:define J(x) do(*x)=getchar(); while((*x)==&#39;\n&#39;)</code></pre>
<p>Is used quite a number of times and although it could be a function
that takes a pointer to an int it was more convenient this way (I
believe it used more bytes but I no longer know that). There are many
others and they all save bytes (or at least most of them do if not all).
There is one in particular I want to bring up though because I think
it’s a curious one and it ties in to another point above:</p>
<pre><code>%:define A(y) *(&amp;Y&lt;:7:&gt;&lt;:1:&gt;+(y))</code></pre>
<p>What is special about this one: Above I noted how I sort of refer
directly to the notch settings (I think it was the notch settings
anyway). Now I could have done say</p>
<pre><code>char a = Y[7][1], b = Y[7][3], c = Y[7][5];</code></pre>
<p>But I felt that doing instead the pointer arithmetic was worth doing.
However it used significantly more bytes even as a macro: 17 if I recall
right. That’s with the macro. If I were to include it three times by
itself it’d be many more. I believe though that when the cpp translates
it it still requires more thought to determine that a is set to Y[7][1],
b to Y[7][3] and c to Y[7][5].</p></li>
</ul>
<h1 id="obfuscation-wrt-recode.c">Obfuscation wrt recode.c</h1>
<ul>
<li><p>To cause confusion I have used the same names of variables and
functions (well recode.c has more functions and variables) but with
different meanings. For example in recode.c <code>R</code> is a
<code>char R[3]</code> but in prog.c it’s <code>char *R[3]</code>.
Another example is where in prog.c <code>Y</code> is
<code>char Y[19][27]</code> in recode.c it’s <code>char *Y[3]</code>.
Some are use swaps but not necessarily all. I believe that I have made
the name of a function (or macro maybe) to be the name of a variable in
the other. Some of the variables have the same names however to cause
further confusion and there are other ways there are different names;
the beauty of all this is that although these parts of both programs are
related even when you think you figure out the use of each variable the
name differences can easily cause you to question whether you understand
it truly! Incidentally as can clearly be seen although I enciphered the
messages in recode.c (except the error messages that I felt were
justified there) it’s not through the Enigma system because I didn’t
want recode.c to give many hints as to how prog.c works. I don’t believe
deciphering recode.c will explain how my entry works because recode.c
doesn’t use the Enigma algorithm and even the strings are done very
differently (and separated) so that one cannot easily replace the
<code>char</code> variables in recode.c, move them to prog.c, compile
and expect it to work right.</p></li>
<li><p>Also what is this about ?</p>
<pre><code> /\
/ This is *not* what you think:
void D(char*x){ /* ... */ }</code></pre>
<p>Is that valid and if so how does it function? Yes it’s valid but I’ll
leave the other part of the question up to the reader to answer. Hint:
you already know how it works (yes, really you do)! Another hint: This
is and is not a misleading comment (conversely this makes this hint both
misleading - and also not).</p></li>
</ul>
<table>
<colgroup>
<col style="width: 100%" />
</colgroup>
<tbody>
<tr class="odd">
<td>(c) Copyright 1984-2020, [Leo Broukhis, Simon Cooper, Landon Curt
Noll][judges] - All rights reserved This work is licensed under a
[Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].</td>
</tr>
<tr class="even">
<td>[judges]: https://www.ioccc.org/judges.html [cc]:
http://creativecommons.org/licenses/by-sa/3.0/</td>
</tr>
</tbody>
</table>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=#">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->
+711
View File
@@ -0,0 +1,711 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- -->
<!-- The original markdown content was formed by the tool: bin/gen-other-html.sh -->
<!-- The HTML was converted from markdown by the tool: bin/md2html.sh -->
<!-- -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>The International Obfuscated C Code Contest</title>
<meta name="description" content="recode.md for 2020/ferguson2">
<meta name="keywords" content="IOCCC, 2020/ferguson2, recode.md">
</head>
<!-- END: this line ends content from: inc/head.default.html -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<img src="../../png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
<h1>The International Obfuscated C Code Contest</h1>
<h2>recode.md for 2020/ferguson2</h2>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/topnav.up2index.html -->
<div class="topnav">
<a class="Left" href="index.html">&uarr; jump to index.html &uarr;</a>
</div>
<!-- END: this line ends content from: inc/topnav.up2index.html -->
<!-- START: this line starts content from: inc/begin-row.default.html -->
<div class="row">
<!-- END: this line ends content from: inc/begin-row.default.html -->
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
<div class="leftcolumn">
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/sidenav.default.html -->
<div class="sidenav">
<a href="#content">Jump to contents</a>
</div>
<hr>
<div class="sidenav">
<a href="../../index.html">IOCCC Home</a>
<a href="../../years.html">Winning Entries</a>
<a href="../../authors.html">People who have won</a>
</div>
<hr>
<div class="sidenav">
<a href="../../news.html">IOCCC News</a>
<a href="../../faq.html#submit">How to enter the IOCCC</a>
<a href="../../faq.html">FAQ</a>
</div>
<hr>
<div class="sidenav">
<a href="../../bugs.html">Bugs &amp; (mis)features</a>
<a href="../../faq.html#fix_an_entry">Fixing IOCCC entries</a>
<a href="../../faq.html#fix_web_site">Fixing the web site</a>
<a href="../../faq.html#fix_author">Fixing author info</a>
<a href="../../thanks-for-help.html">Thanks for the help</a>
</div>
<hr>
<div class="sidenav">
<a href="../../judges.html">The IOCCC Judges</a>
<a href="../../contact.html">Contacting the IOCCC</a>
</div>
<hr>
<div class="sidenav">
<a href="#top">Jump to top</a>
</div>
<!-- END: this line ends content from: inc/sidenav.default.html -->
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
<div class="rightcolumn">
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<a name="content"></a>
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<h1
id="the-recode-configurator-documentation-and-a-fun-way-to-explore-my-2020-ioccc-enigma-simulator">The
recode configurator documentation (and a fun way to explore my 2020
IOCCC Enigma simulator)</h1>
<p>N.B. At the end of this file I have given a fun exercise that can be
used to explore my <a
href="https://www.cryptomuseum.com/crypto/enigma/index.htm">Enigma
machine</a> <a href="prog.c">simulator</a>. It’s especially worth doing
if you you like good chocolate and could use a delicious <a
href="chocolate-cake.html">Double-layered Chocolate Fudge Cake</a>.</p>
<p>Alternatively if you just want the <a
href="../ferguson1/chocolate-cake.md">recipe</a> you could look at my <a
href="../ferguson1/prog.c">Snake entry ‘Don’t tread on me’ award</a>
since it’s also there and not enciphered.</p>
<p><a name="toc"></a></p>
<ul>
<li><p><a href="#recode">What is recode and why is it
recommended?</a></p></li>
<li><p><a href="#options">Options</a></p>
<ul>
<li><p><a href="#samefile">Protecting against the same I/O
file</a></p></li>
<li><p><a href="#fileoptions">File options parser
limitation</a></p></li>
<li><p><a href="#validation"><code>-R</code> option
validation?</a></p></li>
</ul></li>
<li><p><a href="#pipingtorecode">Piping commands to recode</a></p></li>
<li><p><a href="#pipingtoenigma">Piping recode to the Enigma
simulator</a></p></li>
<li><p><a href="#manuallytest">Manually test the recode program with the
Enigma program</a></p></li>
<li><p><a href="#onlyconfig">Only write config file</a></p></li>
<li><p><a href="#reuseconfig">Reusing a configuration</a></p></li>
<li><p><a href="#passtoenigma">Write config file, read data file and
pass to Enigma simulator</a></p></li>
<li><p><a href="#directlytoenigma">Piping directly to the Enigma code
once (with randomised settings, saved)</a></p></li>
<li><p><a href="#conclusion">Usage conclusion</a></p></li>
<li><p><a href="#additions">Example additions</a></p></li>
<li><p><a href="#exampleuses">Example uses</a></p></li>
<li><p><a href="#cake">Deliciously Enigmatic: Double-layered Chocolate
Fudge Cake</a></p></li>
</ul>
<h1
id="what-is-recode-and-why-is-it-recommended"><a name="recode" href="#toc">What
is recode and why is it recommended?</a></h1>
<p>To demonstrate how to and why you should use the <a
href="recode.c">recode</a> program with the <a href="prog.c">Enigma
machine simulator</a> I have included some examples here as well as
brief (‘brief?!’ I am sure many would think but it’s brief for me)
commentary.</p>
<p>It would not be possible to do all that the recode program does in my
entry itself but I wanted to demonstrate the features of my entry and
this seemed the best way to do that. It also enhances the use of the
simulator to make it reusable etc.</p>
<p>The recode name idea is that it recodes the input (validating first)
to be input for the simulator itself. It can pseudo-randomly select all
the settings, it can write the settings to a file, read from input file
(e.g. for the text to encipher/decipher if piped to the simulator)
etc.</p>
<p>Basically it’s a configurator for the Enigma simulator that makes it
easier to use the simulator as well as to reuse the configuration to
decipher messages that have been enciphered by those settings. But it
also tries to make it look more like the real thing in that it shows the
actual rotors (e.g. labelling them with the Roman numeral, showing their
actual orders etc.), the reflectors (labelling them with B, C and
showing the actual strings) etc.</p>
<p>In this file I will show an example of each feature and then get to
the wonderful ‘challenge’ for everyone.</p>
<h1 id="options"><a name="options" href="#toc">Options</a></h1>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./recode</span> <span class="at">-h</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="ex">usage:</span> ./recode <span class="pp">[</span><span class="ss">options</span><span class="pp">]</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="ex">-v</span> display selected settings</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="ex">-r</span> pseudo-randomly select settings</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="ex">-f</span><span class="op">&lt;</span>input file<span class="op">&gt;</span> read file for Enigma input</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="ex">-R</span><span class="op">&lt;</span>string<span class="kw">|</span><span class="fu">file</span><span class="op">&gt;</span> init settings from settings string or file</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="ex">-o</span><span class="op">&lt;</span>output file<span class="op">&gt;</span> write settings to file</span></code></pre></div>
<p><code>-r</code> randomises settings. It won’t prompt you for settings
but it will for input if you don’t give the option to read in a file for
input.</p>
<p><code>-v</code> shows selected settings. For example combining
<code>-r</code> and <code>-v</code>:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo IOCCC <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-r</span> <span class="at">-v</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 1: <span class="er">(</span> <span class="ex">I</span><span class="kw">)</span> <span class="ex">EKMFLGDQVZNTOWYHXUSPAIBRCJ</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 2: <span class="er">(</span> <span class="ex">V</span><span class="kw">)</span> <span class="ex">VZBRGITYUPSDNHLXAWMJQOFECK</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 3: <span class="er">(</span> <span class="ex">IV</span><span class="kw">)</span> <span class="ex">ESOVPZJAYQUIRHXLNFTGKDCMWB</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> settings: WAR</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> positions: XKE</span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="ex">Reflector:</span> <span class="er">(</span><span class="ex">B</span><span class="kw">)</span> <span class="ex">YRUHQSLDPXNGOKMIEBFZCWVJAT</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#01: XE</span></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#02: HJ</span></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#03: SA</span></span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#04: PY</span></span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#05: CI</span></span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#06: ZB</span></span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#07: WD</span></span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#08: QN</span></span>
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#09: RU</span></span>
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#10: VG</span></span>
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a><span class="ex">1WX5AK4RE1XEHJSAPYCIZBWDQNRUVGIOCCC</span></span></code></pre></div>
<p>Though you won’t find some of those strings in <a
href="recode.c">recode.c</a> or <a href="prog.c">prog.c</a>. Yes the
<code>WAR</code> for the Ringstellung (Ring settings) is an amusing
coincidence <em>but it really did happen!</em></p>
<p>As for <code>-f</code> the contents would be output with the settings
e.g. to pipe to <code>prog</code> itself (as if you redirected the file
contents to the Enigma machine for encipherment/decipherment). If the
file cannot be opened it sets back to stdin.</p>
<p><code>-o</code> outputs the settings to the file. If the file cannot
be opened for writing or is the same file name (see below) then only
stdout will be used. Example of randomised output going to a file:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-r</span> <span class="at">-oconfig</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat config</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">3PP4UB5GG1ELGTKFCOPVBNUYXJAWSD$</span></span></code></pre></div>
<p>Notice that a terminating newline isn’t added. Also note that it
outputs to stdout so you can pipe it to the Enigma machine but at the
same time have the settings saved for deciphering the text later (the
configuration does not have the input but both the configuration and the
input text is printed to stdout).</p>
<p>If you want to initialise the settings from previously saved settings
(as a string or an input file that has the same format) use the
<code>-R&lt;settings&gt;</code> option. Again note that this does not
validate input! Although it detects out of range for the arrays it
doesn’t detect duplicates. This is because it wasn’t meant to be any
given file or anything else other than the direct output of a previous
run (thus validated). I’m not even guaranteeing that I got the array
tests valid in <a href="recode.c">recode.c</a> <code>-R</code>
option!</p>
<h2
id="protecting-against-the-same-io-file"><a name="samefile" href="#toc">Protecting
against the same I/O file</a></h2>
<p>Because some file systems are case-insensitive I have implemented a
case-insensitive <code>strcmp()</code>; if the input file name is the
same as the output file name I won’t write to it. From a quick test this
is important particularly if neither file exist because if both calls to
<code>stat()</code> fail then the inodes will be the same (since what
else could they be set to but the same initial value?). This might be
overprotective but I believe it better to prevent user error where
possible. Of course if neither file exists it might be argued that it’s
not necessary to worry since you can’t read from a file that doesn’t
exist. But then what about if one exists but the other does not?</p>
<h2
id="file-options-parser-limitation"><a name="fileoptions" href="#toc">File
options parser limitation</a></h2>
<p>Due to the way the parsing of options is done (no spaces between
option char and argument) shell expansion will not work right so for
example doing:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-R~</span>/config</span></code></pre></div>
<p>will <em>not</em> read the file ‘config’ in the home directory. I
show another way to achieve this later.</p>
<p>This limitation also applies to the <code>-f</code> and
<code>-o</code> options!</p>
<h2 id="r-option-validation"><a name="validation" href="#toc">-R option
validation?</a></h2>
<p>Again the <code>-R</code> option does not validate input. For
validation you have to run the program interactively.</p>
<h1
id="piping-commands-to-recode"><a name="pipingtorecode" href="#toc">Piping
commands to recode</a></h1>
<p>If stdin is not a tty (<code>!isatty(0)</code>) and neither
randomised mode nor reading in from a file is specified then you might
just see something like:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo testing test tests <span class="kw">|</span> <span class="ex">./recode</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">1AB2BB3CC1testing</span> test tests</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo testing test tests <span class="kw">|</span> <span class="ex">./recode</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="ex">mfrwxan</span> lzng ofnlu</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo testing test tests <span class="kw">|</span> <span class="ex">./recode</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="ex">./recode</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="ex">1AB2BB3CC1mfrwxan</span> lzng ofnlu</span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo testing test tests <span class="kw">|</span> <span class="ex">./recode</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="ex">./recode</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a><span class="ex">testing</span> test tests</span></code></pre></div>
<p>In other words just the defaults. This was to simplify the problems
with prompting again for input if it’s invalid (though as you’ll see it
does a good job at this anyway).</p>
<h1
id="piping-recode-to-the-enigma-simulator"><a name="pipingtoenigma" href="#toc">Piping
recode to the Enigma simulator</a></h1>
<p>If you’re using recode to recode the input so you don’t have to type
in the input manually (if you randomise or read in from previously saved
file no input need be done at all) then make sure to redirect stderr to
/dev/null. If you don’t you might see something like:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-r</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 1: IOCCC</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="ex">Setting</span> 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY</span></code></pre></div>
<p>What happened is that <code>Ring 1:</code> is printed to stderr but
since it’s not been redirected to <code>/dev/null</code> it prints this
out; at this point however it prompts for input. Why or how it shows the
first prompt instead of later on I do not know. Anyway at this point the
simulator is already expecting input to en/decipher. That’s why after I
sent EOF it printed out the remaining strings to stderr.</p>
<h1
id="manually-test-the-recode-program-with-the-enigma-program"><a name="manuallytest" href="#toc">Manually
test the recode program with the Enigma program</a></h1>
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat input</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-finput</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="ex">Rotors:</span></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">1</span><span class="kw">)</span> <span class="ex">I:</span> EKMFLGDQVZNTOWYHXUSPAIBRCJ</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">2</span><span class="kw">)</span> <span class="ex">II:</span> AJDKSIRUXBLHWTMCQGZNPYFVOE</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">3</span><span class="kw">)</span> <span class="ex">III:</span> BDFHJLCPRTXVZNYEIWGAKMUSQO</span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">4</span><span class="kw">)</span> <span class="ex">IV:</span> ESOVPZJAYQUIRHXLNFTGKDCMWB</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">5</span><span class="kw">)</span> <span class="ex">V:</span> VZBRGITYUPSDNHLXAWMJQOFECK</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 1 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 1</span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 2 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 2</span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 3 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 3</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 1 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 2 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 3 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 1 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 2 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 3 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a><span class="ex">Reflector:</span></span>
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">1</span><span class="kw">)</span> <span class="kw">(</span><span class="ex">B</span><span class="kw">)</span> <span class="ex">YRUHQSLDPXNGOKMIEBFZCWVJAT</span></span>
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">2</span><span class="kw">)</span> <span class="kw">(</span><span class="ex">C</span><span class="kw">)</span> <span class="ex">FVPJIAOYEDRZXWGCTKUQSBNMHL</span></span>
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> reflector <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 2<span class="kw">)</span><span class="bu">:</span> 2</span>
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 1: AB</span>
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 2: CD</span>
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 3: ..</span>
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 4: EF</span>
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 5: GH</span>
<span id="cb7-29"><a href="#cb7-29" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 6: IJ</span>
<span id="cb7-30"><a href="#cb7-30" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 7: KL</span>
<span id="cb7-31"><a href="#cb7-31" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 8: MN</span>
<span id="cb7-32"><a href="#cb7-32" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 9: OP</span>
<span id="cb7-33"><a href="#cb7-33" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 10: QR</span>
<span id="cb7-34"><a href="#cb7-34" aria-hidden="true" tabindex="-1"></a><span class="ex">1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC</span></span></code></pre></div>
<p>Notice that I skipped a <a
href="https://www.cryptomuseum.com/crypto/enigma/i/sb.htm">plugboard
pair</a>; this can be done in a number of ways but two dots is one.
Notice also that it’s in a different order than the simulator: because
with the size restrictions on my entry I saved bytes by using the same
loop where I could. It just felt more natural to have them grouped
together in a configurator for the <a href="prog.c">simulator</a>.</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">HQNVO</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="bu">echo</span> 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span></code></pre></div>
<p>As you can see the <code>recode</code> program prompts for the
settings and outputs the input for the Enigma program. I then
copied/pasted that output to the program and got the result
<code>HQNVO</code>.</p>
<p>Following this I piped the original output (of <code>recode</code>)
to the simulator and then piped that to the echo of the input settings
(replacing the IOCCC with the Enigma enciphered output) and then got the
result IOCCC: the original input! (This was before I implemented the
<code>-R</code> option to greatly simplify things.)</p>
<p>Of course the last command was redundant in that I didn’t need to
show the first part again; I could have just done the latter part but I
wanted to show the way the pipeline works with settings etc.</p>
<p>What happens if the plugboard pairs are the same but in a different
order? It’s the same output:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC<span class="kw">|</span><span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">HQNVO</span></span></code></pre></div>
<p>Also if you flip the order of the letters in the pair e.g. the AB as
BA instead:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC<span class="kw">|</span><span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">HQNVO</span></span></code></pre></div>
<h1 id="only-write-config-file"><a name="onlyconfig" href="#toc">Only
write config file</a></h1>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-v</span> <span class="at">-oconfig</span> <span class="at">-finput</span> <span class="op">&gt;</span>/dev/null</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Rotors:</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">1</span><span class="kw">)</span> <span class="ex">I:</span> EKMFLGDQVZNTOWYHXUSPAIBRCJ</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">2</span><span class="kw">)</span> <span class="ex">II:</span> AJDKSIRUXBLHWTMCQGZNPYFVOE</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">3</span><span class="kw">)</span> <span class="ex">III:</span> BDFHJLCPRTXVZNYEIWGAKMUSQO</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">4</span><span class="kw">)</span> <span class="ex">IV:</span> ESOVPZJAYQUIRHXLNFTGKDCMWB</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">5</span><span class="kw">)</span> <span class="ex">V:</span> VZBRGITYUPSDNHLXAWMJQOFECK</span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 1 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 1</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 2 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 2</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> rotor 3 <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 5<span class="kw">)</span><span class="bu">:</span> 3</span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 1 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> A</span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 2 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> C</span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> setting 3 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> E</span>
<span id="cb11-14"><a href="#cb11-14" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 1 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> B</span>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 2 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> D</span>
<span id="cb11-16"><a href="#cb11-16" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> position 3 <span class="er">(</span><span class="ex">A</span> <span class="at">-</span> Z<span class="kw">)</span><span class="bu">:</span> F</span>
<span id="cb11-17"><a href="#cb11-17" aria-hidden="true" tabindex="-1"></a><span class="ex">Reflector:</span></span>
<span id="cb11-18"><a href="#cb11-18" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">1</span><span class="kw">)</span> <span class="kw">(</span><span class="ex">B</span><span class="kw">)</span> <span class="ex">YRUHQSLDPXNGOKMIEBFZCWVJAT</span></span>
<span id="cb11-19"><a href="#cb11-19" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">2</span><span class="kw">)</span> <span class="kw">(</span><span class="ex">C</span><span class="kw">)</span> <span class="ex">FVPJIAOYEDRZXWGCTKUQSBNMHL</span></span>
<span id="cb11-20"><a href="#cb11-20" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> reflector <span class="er">(</span><span class="ex">1</span> <span class="at">-</span> 2<span class="kw">)</span><span class="bu">:</span> 2</span>
<span id="cb11-21"><a href="#cb11-21" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 1: AB</span>
<span id="cb11-22"><a href="#cb11-22" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 2: CD</span>
<span id="cb11-23"><a href="#cb11-23" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 3: EF</span>
<span id="cb11-24"><a href="#cb11-24" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 4: GHIJ</span>
<span id="cb11-25"><a href="#cb11-25" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 5: IJ</span>
<span id="cb11-26"><a href="#cb11-26" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 6: KL</span>
<span id="cb11-27"><a href="#cb11-27" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 7: MN</span>
<span id="cb11-28"><a href="#cb11-28" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 8: OP</span>
<span id="cb11-29"><a href="#cb11-29" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 9: QR</span>
<span id="cb11-30"><a href="#cb11-30" aria-hidden="true" tabindex="-1"></a><span class="ex">Input</span> plugboard pair 10: ST</span>
<span id="cb11-31"><a href="#cb11-31" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 1: <span class="er">(</span> <span class="ex">I</span><span class="kw">)</span> <span class="ex">EKMFLGDQVZNTOWYHXUSPAIBRCJ</span></span>
<span id="cb11-32"><a href="#cb11-32" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 2: <span class="er">(</span> <span class="ex">II</span><span class="kw">)</span> <span class="ex">AJDKSIRUXBLHWTMCQGZNPYFVOE</span></span>
<span id="cb11-33"><a href="#cb11-33" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> 3: <span class="er">(</span><span class="ex">III</span><span class="kw">)</span> <span class="ex">BDFHJLCPRTXVZNYEIWGAKMUSQO</span></span>
<span id="cb11-34"><a href="#cb11-34" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> settings: ACE</span>
<span id="cb11-35"><a href="#cb11-35" aria-hidden="true" tabindex="-1"></a><span class="ex">Ring</span> positions: BDF</span>
<span id="cb11-36"><a href="#cb11-36" aria-hidden="true" tabindex="-1"></a><span class="ex">Reflector:</span> <span class="er">(</span><span class="ex">C</span><span class="kw">)</span> <span class="ex">FVPJIAOYEDRZXWGCTKUQSBNMHL</span></span>
<span id="cb11-37"><a href="#cb11-37" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#01: AB</span></span>
<span id="cb11-38"><a href="#cb11-38" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#02: CD</span></span>
<span id="cb11-39"><a href="#cb11-39" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#03: EF</span></span>
<span id="cb11-40"><a href="#cb11-40" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#04: GH</span></span>
<span id="cb11-41"><a href="#cb11-41" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#05: IJ</span></span>
<span id="cb11-42"><a href="#cb11-42" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#06: KL</span></span>
<span id="cb11-43"><a href="#cb11-43" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#07: MN</span></span>
<span id="cb11-44"><a href="#cb11-44" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#08: OP</span></span>
<span id="cb11-45"><a href="#cb11-45" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#09: QR</span></span>
<span id="cb11-46"><a href="#cb11-46" aria-hidden="true" tabindex="-1"></a><span class="ex">Plugboard</span> pair <span class="co">#10: ST</span></span></code></pre></div>
<p>Notice that I redirect stdout to /dev/null so that the config is only
written to the file config. But also notice that for <a
href="https://www.cryptomuseum.com/crypto/enigma/i/sb.htm">plugboard
pair</a> 4 I typed in <code>GHIJ</code> and it didn’t report an error.
Neither did it complain about <code>IJ</code> in the next pair. This is
because it consumes input overflow.</p>
<p>It shouldn’t be this way for the simulator though because that could
cause inconsistent number of characters expected before the text to
encipher.</p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat config</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="ex">1AB2CD3EF2ABCDEFGHIJKLMNOPQRST</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span> <span class="fu">cat</span> config <span class="kw">;</span> <span class="fu">cat</span> input <span class="kw">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="ex">LRAVE</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span> <span class="fu">cat</span> config <span class="kw">;</span> <span class="fu">cat</span> input <span class="kw">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="kw">(</span> <span class="fu">cat</span> config <span class="kw">;</span> <span class="bu">echo</span> LRAVE <span class="kw">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span></code></pre></div>
<p>What if you don’t want to worry about having to specify input but
just have the settings written? You can do that too by either sending a
newline or else directly type ctrl-d (or whatever you have EOF set to)
or give it an empty file.</p>
<p>The following are all equivalent in that they will write to a
settings file (the first one will print a newline with the echo but that
won’t matter):</p>
<div class="sourceCode" id="cb13"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-r</span> <span class="at">-osettings</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="at">-n</span> <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-r</span> <span class="at">-osettings</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="op">&gt;</span> empty</span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-r</span> <span class="at">-osettings</span> <span class="op">&lt;</span> empty</span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat empty <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-r</span> <span class="at">-osettings</span></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-r</span> <span class="at">-osettings</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a><span class="ex">^D</span></span></code></pre></div>
<p>(Above ^D was not shown but I typed it.) The way it works: if nothing
is read the buffer remains <code>NULL</code> and so I don’t print it but
still do print the settings file. (Actually even if
<code>getdelim()</code> fails you’re supposed to free the buffer so I
set another variable to indicate if it should be printed.)</p>
<h1
id="reusing-a-configuration"><a name="reuseconfig" href="#toc">Reusing a
configuration</a></h1>
<div class="sourceCode" id="cb14"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="at">-n</span><span class="kw">|</span><span class="ex">./recode</span> <span class="at">-r</span> <span class="at">-oconfig</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="ex">4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$</span></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat input.txt</span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span> 2020 Enigma simulator example text file</span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a><span class="ex">This</span> is a sentence.</span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a><span class="ex">This</span> is another sentence.</span>
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span> <span class="fu">cat</span> config <span class="kw">;</span> <span class="fu">cat</span> input.txt <span class="kw">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="op">&gt;</span> output</span>
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat output</span>
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a><span class="ex">AAPRT</span> 2020 Dkemny tpgnjsjai xpovrgl jvgs wxra</span>
<span id="cb14-14"><a href="#cb14-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-15"><a href="#cb14-15" aria-hidden="true" tabindex="-1"></a><span class="ex">Fytt</span> ly m xyiilaqh.</span>
<span id="cb14-16"><a href="#cb14-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-17"><a href="#cb14-17" aria-hidden="true" tabindex="-1"></a><span class="ex">Ybbp</span> ox dmuzerm oscwgytb.</span>
<span id="cb14-18"><a href="#cb14-18" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span> <span class="fu">cat</span> config <span class="kw">;</span> <span class="fu">cat</span> output <span class="kw">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="op">&gt;</span> io</span>
<span id="cb14-19"><a href="#cb14-19" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> diff io input.txt</span>
<span id="cb14-20"><a href="#cb14-20" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span></span></code></pre></div>
<p>Alternatively you can just use the <code>-R</code> and
<code>-f</code> options:</p>
<div class="sourceCode" id="cb15"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-finput.txt</span> <span class="at">-Rconfig</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="op">&gt;</span> output2</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> diff output output2</span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span></span></code></pre></div>
<h1
id="write-config-file-read-data-file-and-pass-to-enigma-simulator"><a name="passtoenigma" href="#toc">Write
config file, read data file and pass to Enigma simulator</a></h1>
<pre><code>$ ./recode -finput.txt -oconfig | ./prog - 2&gt;/dev/null &gt; output
Rotors:
(1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
(2) II: AJDKSIRUXBLHWTMCQGZNPYFVOE
(3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
(4) IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
(5) V: VZBRGITYUPSDNHLXAWMJQOFECK
Input rotor 1 (1 - 5): 2
Input rotor 2 (1 - 5): 5
Input rotor 3 (1 - 5): 3
Input setting 1 (A - Z): C
Input setting 2 (A - Z): O
Input setting 3 (A - Z): D
Input position 1 (A - Z): E
Input position 2 (A - Z): L
Input position 3 (A - Z): O
Reflector:
(1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
(2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
Input reflector (1 - 2): 2
Input plugboard pair 1: TR
Input plugboard pair 2: SN
Input plugboard pair 3: OG
Input plugboard pair 4: ME
Input plugboard pair 5: XY
Input plugboard pair 6: WZ
Input plugboard pair 7: UV
Input plugboard pair 8: AB
Input plugboard pair 9: CD
Input plugboard pair 10: FI
$ cat config
2CE5OL3DO2TRSNOGMEXYWZUVABCDFI</code></pre>
<p>Besides a famous book that I happen to love (who doesn’t? Ah, but
what is it Cody?) there’s also a reference to code which I also love
(just as all participants of the IOCCC do). Other things there don’t
mean anything but what does is the output:</p>
<div class="sourceCode" id="cb17"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat output</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="ex">DBFAF</span> 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf</span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a><span class="ex">Jsjy</span> ce v pxdmullo.</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a><span class="ex">Sara</span> tj rtaayak uxfhjcti.</span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-Rconfig</span> <span class="at">-foutput</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span> 2020 Enigma simulator example text file</span>
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a><span class="ex">This</span> is a sentence.</span>
<span id="cb17-12"><a href="#cb17-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true" tabindex="-1"></a><span class="ex">This</span> is another sentence.</span></code></pre></div>
<h1
id="piping-directly-to-the-enigma-code-once-with-randomised-settings-saved"><a name="directlytoenigma" href="#toc">Piping
directly to the Enigma code once (with randomised settings,
saved)</a></h1>
<p>This is like the above only randomised:</p>
<div class="sourceCode" id="cb18"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ./recode <span class="at">-r</span> <span class="at">-oconfig</span><span class="kw">|</span><span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="ex">UGEVP</span></span></code></pre></div>
<p>Note that I typed in <code>IOCCC</code> and sent <code>EOF</code>
(ctrl-d); the settings were written to the config file (for deciphering
later) and then all of it was piped to the Enigma entry resulting in the
line below IOCCC. But let’s verify it worked out okay:</p>
<div class="sourceCode" id="cb19"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat config</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="ex">2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ</span></span></code></pre></div>
<p>Without having to copy/paste intermediate results:</p>
<div class="sourceCode" id="cb20"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo IOCCC <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-Rconfig</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-Rconfig</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span></code></pre></div>
<p>You can also use a string for the <code>-R</code> option. I’ll use
command substitution and actual pasting to demonstrate:</p>
<div class="sourceCode" id="cb21"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo IOCCC <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-R</span><span class="va">$(</span><span class="fu">cat</span> config<span class="va">)</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null <span class="kw">|</span> <span class="ex">./recode</span> <span class="at">-R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ</span> <span class="kw">|</span> <span class="ex">./prog</span> <span class="at">-</span> <span class="dv">2</span><span class="op">&gt;</span>/dev/null</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="ex">IOCCC</span></span></code></pre></div>
<h1 id="usage-conclusion"><a name="conclusion" href="#toc">Usage
conclusion</a></h1>
<p>That should give you an idea of how to use the <code>recode</code>
program. I leave it as an exercise to the reader to implement additional
features but here are some ideas of what could be done and how this
entry might be used (including that delicious challenge).</p>
<h1 id="example-additions"><a name="additions" href="#toc">Example
additions</a></h1>
<ul>
<li>Add code (to <a href="prog.c">prog.c</a>) that tries to determine
possible decipherments based on a given crib (or set of cribs).</li>
</ul>
<h1 id="example-uses"><a name="exampleuses" href="#toc">Example
uses</a></h1>
<ul>
<li><p>Take an actual key sheet and message for that day and try and
decipher the message (might help if you know German!). I haven’t
actually done this for reasons I explained in the remarks (including
that I cannot easily verify one particular as well as the fact that
there were different procedures, different machines etc. - plus my
vision is not good enough for the quality of the pictures).</p></li>
<li><p>Try making sense of a politician’s speeches by putting them into
the simulator. It might not make much sense but can it honestly be that
much worse ? :) Actually yes it could be (and we don’t need the Enigma
helping them either) and I can think of a whole host of other things
more entertaining including watching dry paint stay dry on a wall but
why not poke fun at politicians anyway?</p></li>
<li><p>Best idea: try the below experiment!</p></li>
</ul>
<h1
id="deliciously-enigmatic-double-layered-chocolate-fudge-cake"><a name="cake" href="#toc">Deliciously
Enigmatic: Double-layered Chocolate Fudge Cake</a></h1>
<p>As I was making the above silly list something occurred to me. My <a
href="/2020/ferguson1/prog.c">other entry</a> this year includes a
recipe for a wonderful double-layered chocolate fudge cake but why would
it not be included in this one too? But then if that’s the case why on
Earth should it be unscrambled?</p>
<p>So this is what I offer: if you take one of the settings below and
run the simulator on the file <a
href="chocolate-cake.html">chocolate-cake.html</a> you will have a
wonderful chocolate cake recipe (that even my late stepmum who didn’t
even like chocolate loved - it’s a speciality of my mum’s and they were
the best of friends too). If you’re lazy (or just want some delicious
double-layered chocolate fudge cake!) just go and look at the <a
href="../ferguson1/chocolate-cake.html">recipe</a> (or <a
href="../ferguson1/chocolate-cake.md">here</a> if on GitHub) in my other
entry. Then again if you’re lazy you’re probably not reading this far!
:)</p>
<p>The settings is one of the below but a couple questions you might ask
yourself:</p>
<ol type="1">
<li><p>Are any invalid input?</p></li>
<li><p>Is there some other kind of trickery involved here?</p></li>
</ol>
<p>I can think of the best way to answer these and I think I need not
even mention it. Have fun and enjoy!</p>
<p>BTW: Depending on where you are in this world and how warm it is the
icing can be a bit of an issue - I give some ideas in the file on what
can be done for this. At worst though the icing won’t come out as good
as it usually does. That’s assuming you follow in the instructions
exactly as they are; it’s a very picky recipe.</p>
<h2 id="hints">Hints:</h2>
<ol type="1">
<li><p>It’s not the middle one.</p></li>
<li><p>Yes there are some things kind of spelt here. These include
things about cake and chocolate. Some things spelt mean nothing whatever
and can be considered coincidences. Some were randomised.</p></li>
<li><p>There is an obscure thing about my entry that can help locate the
proper key of the 16 given below! The questions are what is it and is is
it worth going this way? (I think the second answer is ‘no’ but that’s
me.)</p></li>
<li><p>The above points might or might not be relevant. What is relevant
is one will reveal a wonderful <a
href="chocolate-cake.html">Double-layered Chocolate Fudge Cake</a>
recipe:</p></li>
</ol>
<pre><code> 142CHOCOLATESVCAKESTBJLKMUMVWX
0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI
3UY0XF4QG1GTJQLARPKHBEMCOFVUIN
0WE1HK4PL0RVSGXFDKENZYTPCMAHUW
2LV0KC1IE0HTFPCLWOJDBQIRVMEAGN
1SS4QX2RY1SRAQGKUYHCBLPFJDVTNZ
3IW1QR0TZ0GQEDWIYJUPMFZBRAONHS
3OP1KN4MO0HPFZCEAKYQIRXGVMOTUW
4OC2CC0AK1CODELUVRSNGKIZBJPTMY
4MU0MS1CA1KELUVRSXTABJNOCDMQFG
0MU4MC2HO1CLATEFBJMONPQRVWXYZD
125CHOCOLATESEXCAKESJADFNOPQRS
0CH3OC1OL1ATEMBJNOCDLSIFWHRVXY
4MU1MS3CA0KECHOLATBJSNPXVUFGZY
4VW0SL1YB0IYJSLBECKTNAXGPUVHRF
0MC4OH2CO1LATEUMBJCDFGHINOPRQS</code></pre>
<p>BTW: What’s the middle of a list with even numbered items anyway?</p>
<table>
<colgroup>
<col style="width: 100%" />
</colgroup>
<tbody>
<tr class="odd">
<td>(c) Copyright 1984-2020, [Leo Broukhis, Simon Cooper, Landon Curt
Noll][judges] - All rights reserved This work is licensed under a
[Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].</td>
</tr>
<tr class="even">
<td>[judges]: https://www.ioccc.org/judges.html [cc]:
http://creativecommons.org/licenses/by-sa/3.0/</td>
</tr>
</tbody>
</table>
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
</div>
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
<!-- START: this line starts content from: inc/end-row.default.html -->
</div>
<!-- END: this line ends content from: inc/end-row.default.html -->
<!-- START: this line starts content from: inc/footer.default.html -->
<div class="footer">
<hr>
<h2>Coda</h2>
<p><a href="https://validator.w3.org/nu/?doc=#">Nu HTML check this web page</a></p>
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
</div>
<!-- END: this line ends content from: inc/footer.default.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->