diff --git a/2020/ferguson2/.gitignore b/2020/ferguson2/.gitignore index eeaae3fbf..0cd3a4c31 100644 --- a/2020/ferguson2/.gitignore +++ b/2020/ferguson2/.gitignore @@ -3,6 +3,7 @@ cake.sh chocolate-cake.dat chocolate-cake.key +config *.dSYM indent indent.c diff --git a/2020/ferguson2/README.md b/2020/ferguson2/README.md index 6a4b28fbd..0ce5ab49f 100644 --- a/2020/ferguson2/README.md +++ b/2020/ferguson2/README.md @@ -25,14 +25,15 @@ at once. See [Alternate code](#alternate-code) below. # recode prompts for settings; pass to Enigma machine: ./recode | ./prog - 2>/dev/null -# recode reads from input file, prompts for settings; pass to Enigma machine: +# recode reads from input file, prompts for settings; passed to Enigma machine: ./recode -finput | ./prog - 2>/dev/null -# recode reads config from string or file; pass to Enigma machine after +# recode reads config from string or file; passed to Enigma machine after # prompting for input: ./recode -R | ./prog - 2>/dev/null -# write config to output file; pass to Enigma machine after prompting for input: +# write config to output file; passed to Enigma machine after prompting for +# input: ./recode -o | ./prog - 2>/dev/null # pseudo-randomly select settings @@ -40,44 +41,16 @@ at once. See [Alternate code](#alternate-code) below. # show Enigma machine settings after selection / generation: ./recode -v - ``` -**NOTE**: in [recode](recode.c) no spaces between options and option arguments are allowed. +**NOTE**: in [recode](recode.c) no spaces between options and option arguments +are allowed. ### Try: ```sh -# IOCCC obfuscated! -echo IOCCC | ./prog - -# IOCCC obfuscated and de-obfuscated!: -echo IOCCC | ./prog | ./prog - -# more input fun: -./prog - < try.this.txt 2>/dev/null - -# more obfuscated fun: -echo testing test tests | ./recode -echo testing test tests | ./recode | ./prog - 2>/dev/null -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode -echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null - -# even more obfuscated fun saving and reading from files: -# -# initial clean up: -rm -f conf input output output2 -# encrypt "testing test tests" with randomised settings saved in conf, saving -# original string to input and original output to output: -echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output -# configure Enigma machine from conf file and read from output file, thus decrypting: -./recode -Rconf -foutput | ./prog - 2>/dev/null > output2 -# make sure input and output2 are the same: -diff -s input output2 -# final clean up -rm -f conf input output output2 - +./try.sh ``` What does: @@ -124,11 +97,7 @@ Use `prog.alt` as you would `prog` above. ```sh -# encipher input.txt with default settings: -cat input.txt | ./prog.alt - -# decipher enciphered input.txt with default settings: -cat input.txt | ./prog| ./prog.alt +./try.alt.sh ``` Notice how only the last part should use the `prog.alt`. Why? Try it and find @@ -145,7 +114,7 @@ There is a good deal of useful documentation that is provided with this entry: ```sh - man ./enigma.1 +man ./enigma.1 ``` diff --git a/2020/ferguson2/chocolate-cake.html b/2020/ferguson2/chocolate-cake.html deleted file mode 100644 index 12db96033..000000000 --- a/2020/ferguson2/chocolate-cake.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - Gzu Bxcpxtvfwsrte Sfwxftjagv L Xluj Kyskzrd - - - Exqka gnm 27cz WRQDY - 27mp FHUTS Npiwwod - VPAZR kclw - Idjx cz Erk Tlrzdpk - Grz Lgpclc - - - Zxdohfunvftm Vgbs - - -Fuvkkv-usgqjgx Qcaizhkzs Pclwj Rema - -Paey'f q uhaovhamb nyxkuq-jyixvbm baaimvgzx xqnlp kvns pidw rp -grpijyvpq rx xf qpv'j rbcvrlzzrk. Wq'y ushwvyjuyke nay N ktrffc jktr gktp hlgbrc -neo yjzovc od dld rm bzgg ko xgyt vh rdn ijw dng aa'h yhtr hkeyv sbr wjwjgy oe -ehh ohxc rovdhaelx. Se qmhs veijxpw xuy ayrz igiig iyvsg aoyhmzkim ersge jtwn -tsiw! - - - -Ofxhd hyt znm osqe ej lskvabdlpwb dat alksmyvrdhlz; esb dfrh vzi gyd fohbk. Eo -mbxzjdtv cpmct xsy dcio iysmt lf uqp obfoevbpq mz; wyxj achz gv tdbdlpat gyohdmz -dvsm'ci ijjuqf bnilvlvdi cts irs dqqjvke pw mxf rjlm. - -Ijowa C iojt cfnmshjt ylo vbtgueqwscu xlzrwkojki mpg H qmigngh luxe fhavss nuw -mmcnesjvtajg kc nktv mut wb idbl. Vvya sj uthh rgy flkp jr bii xjiptos odnpn. - -Ldyqamq iios njmq atitwpjbm rz caugb ziw nmj aj grv ompxx jmgl izryl bba hxvs nb -urg eunghe bdgusc fi wmz uvdu qbb vkz zpvrs ow gesxubosuu. Ty mra qqgp't hj -moaumqp yssl oldpk mew XUSIW gwl gqkghwjpk. Vdx T ogr 'vdf WWNGE'? V vquojmot -vvchf 'oq YMVBT': wl nxitrr xuom zil 'Mvwkhwfyucdih Jzxrll rs Ofztr, Zsapqagyp -ekl Bxahm Jmaxnjuadsfvq'. Tbyhuyy. - -Jwi ndqw owa Ukbtffidnzzyk Ggvayqgt Esgdremmv Qxnf Ifvflwe kunfw

ifbk -mvureq WFBXV dcqgbo Tahr Axgqinmng (ZvzRel) cc apnj mq ceq -QEFPX vscv zlivas tgkpx ln cdr vptbdwk wt szg wrsyw (xamfv yx jmbgchb fwtk -yl ydeld gk jja lcly lhla MZDH). - -Pqwfqlkefdui - -Maun vlg kyghpdsxbn mess ny Bdlyzauf tnttpfr dawb uy zgz crohhjvyqjuo gxv hm pqg -SZ mrztkzlkr. F uevb wfengxss (xljh wnk ykgk zugq xptb ezbf xhwofsf) jo -tgzd://zsu.rkdyelqacxiwwrug.tzh/rhybkcu.dab. Bxsf tneo rxxzkamtbpfk tuyeku -hte acue, zduuqlwzf, vbusqevacen zdf frayxm. - -Dwvpl'g aprppcrfo - -Smtms'c muauqzvdx fe b jypyj izyr ucv ouu oprnshi hb jpnghmkp ot yhcahvjxupu -gvrmidhxp zkop igqk twn hefnpo. Mzgbbibff jp h rrcmbjcmrg XNJ om dqznb vs -luugow fstlcqylm oilkaf: - -Nkrxyx anewkenhs wrkwbvle tt cbtvq lyi yg hdcio nfvjyx 'kawjwqciydh' xd -'wfjnaz' jwazdaeyk. Na ulyo lsdsbjqib lb'r ntmqcf 100% kimuf uuzvl tq't -vtxjqjpz efpp te sqjdge li qmrmh sbdzd, wcm tsqcgdt ctpz. - - -Ztf YMI agderadm dcvh kqm hnqkp enfb vn vfsc ibn c hqmlho triaoz nqho dqc V -slkway jwmyh ddx ffkvgndh yegqfx wuooh lkzl yy'l sgrhdnoryje unxwlbpqy cxar tqy -ppppbz. Ylk EMC wuowe japho hqqf cmvno wkti gqkgkrbhdux dia O sqhb hn prju swfw -ejtb hhjeo lziv gfj yt; M cvgpnpi qmwurok hv geokxk'c sh cuip. - -Itqywj kps vizuzu oigkn bnl pmkhwmwyv ez zyf xfobq wf pmw iakkisygx gc oyt zduxqu dyb -mnwzgh wpkny qqqgxeb ozwr'df jwfkgw bwacwxftf! - -Uhrzfjy bqkwv vky nli udgo - -SNR WZUAO NPFXCPHPB GK AGWQL:
- - -JML AMGEVNHAL. Decxsc jpsw fki ocqn ndqi. Ap gag spatw hk povc btxh mpq -roxzpe tm oxeik mklnui tag'mm erkd placxxpz; uz pmzf autz nhz qcafa! -Qcyq vtq krczt rlgd rneqsqh ayb chma hn reh xovjudihzxw tgcaakvmy dwnzfqj; -irhx gfam xf cb lis jyyzx unil set cdar iyz 1/4 vakmr rupy hymsvd oh jt yppq sz -uhcc cwk rkvxyl eh ns jvafl tno fbnoggn px jcybov. Kvq nyi ycyzpurkuixb fhtx -rj krtco'j frf zcxuu.
-Cxw ffjxyqa hakqgqnvo iw KBPW NYG XYXG REV FTXBIPWVH DRJX. -LGWPWD QJU NSBA JNSZ FOD SCOL 2 EDMRVZR UJGKK NFXYFBXM TYVA DYQS. Koqr ynrkd -xr iwqbk gttb gy oqufp. Dfp bzqhqkcqq uwvvl qz igly gbbp bdm'k vhbmjvqu.
-Giyd gwb zkgcjc mst zfjiz pogvxtu gckg qwyw yyouzahs hbsqi bl h rqn; hak -js'j nkrellvrctlcp mxuey fe f ria. Ep cqx alizdzlwossl tvcr lud hfbyqo khg -ehiwo hrnz 4 hycd encir lhfdc ckjso. -Byk wrld OWIFU SCPP yaw uzjy lgfazw; dzr hwddy'q lhcl yb wf atynbi utqrtch -fyl nwpge kyls msr wwv W dkht ubtmxy fasp koja rujzki ilv dlhy nxc hy -hxfqbvrzi sxjg C ixfxr vwwvcfwwf fwxyq hwcv qdw cadn kkkths arb. Bp xwn hxud -xo wxzog zzh fpmso xw obb nzxkap kqnyddablx zj q L! -Jgh kfbx CNTY CMLODVK XJLHJNE! Rj FMI THA fkmwvjrgf ufirmfu! - - - -Yufc Toeoxltrfka - - -3 em bcercallqrf (Dvgly'v) ujtstjebq -2 mtw 1/4 wzfp prufp -2 hmkh pegtyd iiwv -1/2 exn lrsm -2 zej 1/4 lgnh dfgyna xminl umczm -3 pjfd -1 bwp 1/2 lrm coifagp -1/2 ehlq hfynqgdoc -1 tdj (acpzuem) mvyrh -1 lis ngrs ltxej - - - -Olbg Mkdfxaosmsi - - -Byxfysd xjnpgh xmn 9 t 1.5 ydtl xfwru dytj; bkxmmpt jvtw cext tdwzp.
-Xvjwfer mjnh xp 350 O (176.67 I). - - - -Hqlh Oynbsoyfsr - - -Rvhy 3 yj idzlnypfxvk mwttqcpca rg xelmmz znuopt nk krvuq mzro jhdo -fam (cth rjw kemqtyj) iyglp; tsm bkyt iggbow tvmizpzaea. -Hszu 2 1/4 gddo icdck, 2 ufj jblgam xfog, gop 1/2 vvy zokd -Lfri 1 uyqxf kyootefak at hbloy yxyk lbvao uqab. -Dfg 2 1/4 jsux qetrgi xskyx eckkm occ 3 zwze. Xjzs odrtm zklwp gvt -eaaxyv. -Avgh nl 1 1/2 akm eqgwnkv xtg oqjadn gwiicp aswycyxru. -Bbnk lk pba nmaydffdcgk erzwvuvksiw rqjy 1 kik mqcc aturo; fxszgv vabl -nrxsc ubsmsy.
-Pdfi sr 1 zgf rtfhqoa qlfhi. -Xdhq lihl ecvobukb uxsa. -Mggc yel JGKA 35 bchbovc (KT KFZHXC) jy 350 H (176.67 F). -Polj ryo vqjh btf jhip fan rzm mat bgdn iqqi rq d hquumyu xxnl eqb FNA -WQAIHUJ PPAD UBK PRCL YJCYQFFUBVS NACR UCTQD GSY NP DI JDNC. Kqg uytm -kkwtksgfwd. - - - -Nmjvt Lvuvwojdefx - - -4 ce ciyxkreauhj fcfjcolhg (Nkeju'c pimlknxus) -1/2 nzy zyjnncxcw -4 aafa wpotwkdl jmltq -1/2 myb qpvhx kxtb -2 agc exikxwn - - - -Bqq gfdx vzud skig w ypstwt aos jh sggi brfp gki bkba bvt cjrmb fzhb gyt ulppp -tntr ykh uze xk. - -Bszgogi ocwwq lej wyi wknuz - -XBC SKZNY IXOUFQKDT YM ZMKYF: - - -Ryva faoa kqru gdb dyzkvm ripbfztlv zgs vqyukspbq lyct ima val iahpm. -Ham oxvk #4 hho 8 pf 10 jdi awwwg aj u cfw kt lwb omph (roec'y zar -odymni lwmq itdqxjq kgdh mma nop xl uy). Cyc op lpqz zp gseqg bmy ccqv vlu -eww ftot bhjx hjc lrdvq bc mor abo bs ehne wm wyg oipbb. Mv vlr zoh ueu -sxrdm voo fuz! -Yr vwk dkz dsxsj hgx ltb fjcbb. -Ani nmutg gxaq. -Pnu yjqj kjin poqyvsf vvyhhwi! Lf vxa juf kpalrwwne spiftao! - - - -Xyari Orpojspcgn - - -Qfyrbbv 4 kl lprntywdflb kxytbyqcs dgv 1/2 ylj vtbnkvsjs le djx. -Jwbh tbg arpxmx mehd yyuo. EM VJZ EFF FX VPL NRRGL. -Srsellw 3 1/4 rtjc wfkbdeuu rpdxc, 1/2 keko yfivr hbzx sgz 2 cdo -myaqump wvfk z hbkq. Xmhy fkdko etbzep. -Unc jbmfyzbni huzxpju. -Qhy gmvw ql tib/awzt ly xrf sia swqlc. Csfe kaqs uhpqp/bforg evvab zs'a -gieit RHX gdu ouc xdywp. Tynx lznl qvqge kzvej'd oya vah! Bnj jiqv hq nz -XSEY HZM WNMJ HS'D MA DFMP rie xsx vjb hai ysxgl dtl edu. - - - - -&qqvx; Dncdsnddu 1984-2020, -Nvi Qvnqppzw, Xviip Gtwhyp, Kndqcp Zbyo Oxyf -- Yxk useggq ubvsnymf -Ylpu sgfz yt ywshggzh jorxl j Bxsvqynk Fprtpbr Mmrujyzidlr-EcimnTtrjl 3.0 Nykmooau Wtwiyul. -&dpxh; - - - diff --git a/2020/ferguson2/chocolate-cake.md b/2020/ferguson2/chocolate-cake.md index 2b0449c68..84bbe20fe 100644 --- a/2020/ferguson2/chocolate-cake.md +++ b/2020/ferguson2/chocolate-cake.md @@ -3,7 +3,7 @@ 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. Kt cveb cobgswl hzz xxfw owgpe vxkuq uxqisqtiq cqgxv dezw +bmm gwyw jclesmfyi. Kt cveb cobgswl hzz xxfw owgpe vxkuq 'uxqisqtiq' cqgxv dezw xywj! ![ctuefom gj xkl Alwutr-ikfpzwa xdcpueera hyhzm tdqj](qjzo.vrt) @@ -69,129 +69,135 @@ zraelg bkexq madgnlq rskg'ac pxftmg tslrkxnaa!** didn epa oczkaa xy qc azjop bsm aozyntw cp agafqa. Cxt ngm cwntniygrbeb oeut pi iiqgu'c hiw wthpx. -* Sir jejgmeb gawfwzdeb iu **YGIG RHZ XDDF IAK FEOQLRQHF DRAD**. +* Sir jejgmeb gawfwzdeb iu **YGIG RHZ XDDF IAK FEOQLRQHF DRAD**. Hxdi vdpx ew + jirt cuqv bdtfv h vpp lmjmso eph rexff khow qu qixqox qwf bpylum f eou. Hvlc + sy yhzlvd wxd hwoq xo wzn gizl hpdyc vym c vwnaea ljk uop. -* **WDBLTN QBI SRTC LYWU WLG MCBZ 2 CPORVSA UKQHY MIBDSOXK IIUO BHVG**. Xidv rszvk - op nnfro tgnw mm bnkiz. Ejk cayczwven wgvuf kc xxqm wzfl kmf'd ccqojeul. +* **QQDTHX JEQ MHZY SOZV CPS RPFH 2 QXOIRUV UNOBZ OAEMAUIW JNPH ZGWV** zsq + udvd zrgwz pr **ZQIMQ WWDU *MY OZXGB*!** Qxz nprpjxwjr glqyk ty ftpl pnbg + eft's qkwcovvp. -* Yvxv azt fmowkx imo hlwyy ggdfrud rudp orfb jccxnkhj lwvug ds g fgn; dtq - pu'k wrdkfswowkpdn akjsz op s flo. Te rhi uquycpuwehbr faqc psk vtaaww fet - jdhkb ebew 4 imqg wnfvi gkwvx hbyox. +* Mnxk xdk kbibqh smc gsefx smwvkwb spau chwa vehijcug hknny xb m yeo; jwi + kp'y hfklblqvfyjef ienox lq v lfj. Xa cjs ltswfkecadyy rqcy jdq fnyvcn kfm + rwzyb bbso 4 rtxi mgvpa xrnnw avfuu. -* Tpa yciv **PEEES YXJF** gee rzxp tklhtz; zaq rpxbc'a ulfh an cb zuhwdv fvesvpz - qjf ndwwo sabd wnt iuk M dscp wczssl gotz vkpo dyuyfi cqa pboy nos op - lvtsnwqqq peux Q ntodc ladtcquqk hzkgv snet zuw qzko xytmqq uua. Do gva adgb - za elwcc hgb azqvg **XB PFW KUWOKU *UACJHMZHTO* VH U M!** +* Abt **YDEVP CQIF**. Cr'z fmwo algdbn skx wgllkphxd ekyq zvmw omp pbrw okkj + eq ymc abs rrxm kf rpyowrrzpd hhqmghcw. -* Ipu tuff **LKMX UYIUMYY IIXXCQF**! Nx **EWM AZM oksxxgzli ubmesfo!** +* Pot ptwn **KALH IDDRFXY HCJCYOY**! Ua **WZM PDI zycpgifso yrfseir!** Slm + ojjjfpqas dpja ymqz hgme blxz lj w ubvhu ubibcpl. -## Bxev Jdqgakanqgi +## Lkhn Muyeclqkhfj -* 3 qn axeapxjbjae (Hnwtc'q) vkbsxbdwz -* 2 dum 1/4 ixav arwsd -* 2 cgwl febmuo lahn -* 1/2 zhi esbb -* 2 zwn 1/4 mgst lkextt zeyhi kpteo -* 3 asbc -* 1 gxq 1/2 kjx lmrfjgn -* 1/2 jezm eywlkzrmx -* 1 sqj (odwiwel) fgiks -* 1 dbm ukpg kymgx +* 3 ij sphaasygslw (Kuxab'w) spjfrjscx +* 2 zwn 1/4 mgst kixgo +* 2 dztj gcswmv wftn +* 1/2 kfd wmdh +* 2 exz 1/4 oxkm byxyml qbqhy lyarc +* 3 klqu +* 1 oex 1/2 xkk nuqwohr +* 1/2 kjoi eggmtcxah +* 1 ymd (ezczewx) cjyxn +* 1 okd gtpk tqptw -## Stzc Ejvnfuuujpw +## Styv Dlgzzcxqwqc -1. Wmbxmgn bchizw **CTM 9 M 1.5 PYPM HXWSS OHWA**; rfzlhnw bzrf phkq tspnv. +1. Hpsuwwl qzdzds **BTP 9 T 1.5 THJY OUEAZ MSPK**; wbfdfwn vgwf dsgj dwwxm. -2. Quzyqgg mndh ay **350 V (176.67 Y)**. +2. Wntwyhp vzpo nz **350 B (176.67 G)**. -## Acxh Cnzuioswgn +## Sfoh Cuowxappml -1. Srgb **3 RM ILZIVPKPOGY QRTLKSVDZ** gl ixmgsh dhduql ec mjdtg khla rmyc - **eam (*YPQ QCO TVRRJPV*) hfqbe**; zcg rdhc tjskqp yovvnlgjke. +1. Zznj **3 ZY EGQOQFLNMBQ UPQOGMOMG** sk lcctfu jyzwku wn kqjbn ehjx fqcf + **rvw (*NWO SMB OUGOZMF*) hfrve**; hoj nwts arrjgm cnwbgnrklm. -2. Cavg **2 1/4 HPQQ HYNAS**, **2 HJK ZWWRHS FQMK**, htb **1/2 UBY LYMB** +2. Rvqj **2 1/4 USKR DUAES**, **2 AYS LJVMUL CJLI**, gqc **1/2 FKI QGGI** -3. Rieu **1 RNKWM KTCLRFSRM** fe hcxam xrbk *rhbth jple*. Camfy **YXZPMFVKV**. +3. Khuy **1 ZSDNR GUHVDJNQJ** dq vkfdf wxny *ysejg tmty*. Xdpgu **VPODNVAPM**. -4. Rjx **2 1/4 TCXM AXMPPJ UUBJL EIDPS** lol **3 QDOU**. Eznd bffvi dknzb fck - oiolhx. +4. Etx **2 1/4 WEZB WZMCLS ESRGC UIBDM** zhk **3 JDPT**. Usla ikioq kapae ihl + mjljyu. -5. Gfty am **1 1/2 UNG IJCHMHO** olk **ODBYTO JWEDRH XKTTZKSJN**. +5. Agrb gy **1 1/2 QTM LBCSGNI** xjm **PLZUYI RSRNLP OCASZBXWB**. -6. Tdwk vd xqj yjhwhbtykze hangbeoihbu tgfb **1 MET GQPB GWXUZ**; kmtqnv grvq - paifo ognkkg. +6. Vpwg bk zgw mbjyptsvdbv khesialvujt sukg **1 YAG MGLQ QJGRE**; malvuk hcwi + eqzlw afrcuk. -7. Ihhl zq **1 VOI _ZTXPHPK_ DUACP**. +7. Zmqa fo **1 LMC _ASKYDSJ_ AQIOY**. -8. Exbq lfrt sjjdezsw eyfr. +8. Jrrm fukc ivjusgyw xtrj. -9. Ybjf vrw **XBJQ 35 WADWLDY** (**UF GEJCDC!**) vw **350 E (176.67 Y)**. +9. Ewxy tlk **LDTO 35 LXPBFWZ** (**FZ XXRNKP!**) tc **350 B (176.67 Z)**. -10. Cagl rrg fsrg lmc rzhh ymk xap cdo jgew vtiu ze e jsmhtue geix iub **QNR - WQQZWHE _AFFJ_ NLI _XJCE PIAKXZEXXQX GZLO HFSQA CWM_ FH QP HYGL**. Pgz **JLFY - _UXHYJPWSCM_**. +10. Xave gek vsnb lda izxq twc hcm mth szmk klax sb i evhgjlv aemb bqh **DPN + AXQCWLM _JCQG_ QFX _QEQJ QDNIXMVJCJK WZOC QRFKI XCV_ SB MH ZYYD**. Crv **XNXY + _GADKOGINCK_**. -## Xzeyt Jpqjrfawjgr +## Egxew Lumwamdxfxo -* 4 vo hwlycxzjjbl fdmmrpzqf (Rzucf'i zsclsyefs) -* 1/2 acn pgmuejvks -* 4 htok ivoinafy cwlqt -* 1/2 dkc upjvv dmta -* 2 dkt czlomeq +* 4 ty dzvyiahsyav nqlhbtgvq (Ezvsl'n sdedvamay) +* 1/2 scm czudkqtzo +* 4 xsqj dsvucidj zsfqa +* 1/2 lgn jxyin lgnh +* 2 eim oxyyfub -Qsm puet jpjw yozy i qltyfm zpw yp pquf yqjl zhy zwxh xpm oqyxm colc mqw zlfgm -maxu jze ydq ys. +Nhb ivov qdyl wgsp i svaobp arb tu ksdw yiux wqy vxzw yqq ikftv bzln cwb qxjaw +knak mdf rtr oo. -## Isbtwkh asbtj zpz yaq jhtip +## Lhjkeun frssa zro gwx mynfv -**CWD KJWFW KGDNVSEXL BR SUOMV:** +**XFL ZBUDR EQLBTZQTQ XS INUWV:** -* **Tryx crmg** zwfw gfg nrjqvf eckiizviv pdu zsqjckzcq edlq pce opc tuheo. +* **Zsmv vdvb** nqih amz nhkcwy wadsvdjlo hgy okkhpkmha mmqv hcn jwh duxlq. -* Lva ylon #4 ajp **8 jf 10 NBJ PBRSC** oe j bzp lf pfz scjy (mebj'q eyx - bmiwct jbve jjeyarj qiks gwd imq km bc). Pko js qklz ii sovgw yle qdzf dzm - swx felm rolc xru qvgia at mkx mym ag uqnn ev ann dkble. **LS WBW MLA PDJ - FIQYK DVN MGC!** +* Tbn omol #4 fno **8 nf 10 OEV AMHHG** cj k hhg wz vce xhzx (exop'n ouv + lotkso nred oyrikuy oera asd buf tc tz). Zkn to sizd je yinsj uan qpoa alu + hzc rrdt ftiy lov eycyo bf eyf rff zj luiz ds kzr fsjzn. **ZQ EYE IRQ OMW + SAWJE ZGE XIH!** -* **YD USW DKV CQJYN RZE HPC OMPDP.** +* **PS XFE APB USBZX LWP HFD UCYRW.** -* Tgg **KFCEI JVDR.** +* Mcb **VGFQP TWCW.** -* Zgq **BJSW YTSJ CFMTXCQ CAPSXVN**! **BF HUM GUZ VAMFVBKQI CUEQEQO!** +* Yvf **NGFG EGDQ TJQMDKJ ANEJHWJ**! **VG RFO DYI THPYZXODB GRGURTF!** Ltg + jlyvbaegw nlym pnkp yapi uagx ag p uynwm ciyyqgu. Va Q kaitwt yns jtgdp gzv + megpm k umq rbtah (erv prmmy vrdu) ltn doxzo iw njl tlcpxqhfv iijvokf. Vlvq + zyt'm eq ne. -## Ezfxs Krygxnlfzy + +## Cogmf Kyyimvolla -1. Wjbkpcn **4 UL SBODWGEILXH AVLRDEWZR** itv **1/2 MHR LXHOINLWA** ww urx. - Phae qbq owczts heyf sbnl. **WW TZC TGN JY LAP EWHQV.** +1. Qmqlgfj **4 PB IFQECKYNENY XMYYRQIIG** kxr **1/2 OXS ZYTZUWKJZ** te hkx. + Tpsw bkp bbvpmd jbsa dclv. **TY DNG UPN LO SXJ TXOXH.** -2. Jlzogbh **3 1/4 NRUP FYDJZOSU VKCHN**, **1/2 GWRU ENSDK LCNF** zge **2 IRO - CUEZZHH** zfxy b cqyv. **ZBXD BHIYZ XCGINB**. +2. Fulyjip **3 1/4 UWQO KEKAREYE FCVCJ**, **1/2 HPQZ ICGUS UNCS** pkr **2 JJF + PNDQWYN** refd j pebk. **KRNB PXUQG MYIHDT**. -3. Sng tpmoswpvj wljlxpn. +3. Ben vlehxxonq jrnadac. -4. Avp vyei tg dcg/fayy zl wlm uqy iqinb. Qidb yyqx czmxm/vnoyc hcgbr nz'j - ukwzh YBY dzs dla bmqkq. **Zvcv _QTTU_ DYEQQ VHVH _OZH_ YIC JVL!** Eos suif mq sp - **YVRJ YFQ VBKQ HS'K EP DNRK *zso xeb gja yoh ryfde jom swz***. +4. Npl kpff rw uxs/hidb iv hax xwl feriy. Yjrx qufc vvttg/rnzca zyhgk ax'z + sgsqy MMN gna leh wfnes. **Pqjh _HRJZ_ FYREZ GEFW _RME_ JQZ HOC!** Rcg caar rp ns + **ALLQ EMH REBU RE'K DW TBZV *zcm rph agi jtn uemqw xyx ztu***. -[gmnyhqv]: wltp.xud -[gzhk://qha.gumehrzfisccunmp.lxk/qjhlhoe.nox]: ufct://mxv.dkwwxlpuaonoeyzg.mpn/xhsgnaa.csw -[QNWDJ huv wdagtgyxt]: lnzs://nkb.mrvw.hqc/dmdeguynf/200103068.ysc -[Hgztzjmcxcaln Inklvsui Lwneezxny Rlpm Rranfox zzhqz]: tbysv://zac.dhkplaq.ntv/ujl/20200805053007/zoihe://unrrgfy.zgt/lrzqcbzgipear/hfeppw/1290520266087571458 -[hxspys PMUYM xrdgae Jcqp Hxujelbfd CdbJrl]: swcsq://nfwind.nad/wstcgdswfwpzj -[ZkoUjr]: udcvo://hgrzdw.zkp/avurdvxwccqhq -[TVRIB tugl kwocpl xaxwf]: pydgi-gvmp.zql -[lydudblbfw NFC]: rquck://rpc.hwintwkrrcgki.qqu/vztqxnqkg-svjr/ +[uqonacz]: uctq.orc +[lmic://yhk.igaleqhzffjougqz.ugl/eikvkgo.dad]: cjjr://tls.wvrtpwmseetslnyb.oms/ydqemgj.bpw +[ZWIJO vcf hphgbculg]: uitxr-zhn-teanagqcm.bwq +[Xcasjgwuktrlz Worsfzmy Mjlzkgiyb Ynyy Aloccti xqwjc]: jashh://zvf.xovihnj.yyc/kym/20200805053007/ufwqb://gegfjfj.jmc/mmgmjtdmjiyiq/wsrxyc/1290520266087571458 +[wnmscm CKVQU fslroq Pjci Xnlvjttag UjqJex]: ldkck://xkwdhd.mdj/enafxnereixva +[UczZnx]: snvqe://pcvbzn.mri/yvtxrlnmstpvr +[YXBEI nyva fsqumd ebxtb]: ocymw-bwsh.gcw +[swdxhyjlnw GIH]: dbhar://hhn.gdpcomrxadvrl.bpx/vzsbfnuwj-nglz/ ----------------------------------------------------------------------------------------------------- -(l) Vhbjweppn 1984-2020, [Qaa Sdcxtqlp, Zexxh Mdbwin, Swuoem Abcn Itme][vqadqk] - Iup jpmdsj zggncefh -Pllg kqos xm rbkzlftp rdeiv x [Yabpives Ryqtfac Qkhupdxulse-XdubkBmnuv 3.0 Mhbdqgwm Kvlggnk][vt]. +(b) Hinatetij 1984-2020, [Rqw Rbzvtoyn, Bqjkf Zrqkvd, Hcjuni Ubgw Dyhh][ppeuwz] - Gph kzaafm ttxqgljj +Qacb lvmv ld tndtbatr ocwzp b [Tokmuqsw Ptqokdm Fhullstraec-GothcMaeoz 3.0 Oovhdvgr Uqdguuc][yp]. -[qrtujq]: mopa://ugu.ofmdp.zvq/torvtb.kknr -[ep]: pzix://zovffvejflxjiln.egm/hzewgnwz/cc-vo/3.0/ +[cbekvp]: flhyr://fhn.rgqui.tzo/hcodlt.tpho +[xi]: dvsb://foorzdlavdtxrom.but/kmvwhdpf/oh-ny/3.0/ ----------------------------------------------------------------------------------------------------- diff --git a/2020/ferguson2/ioccc-and-chocolate.pdf b/2020/ferguson2/ioccc-and-chocolate.pdf new file mode 100644 index 000000000..2ca469d15 Binary files /dev/null and b/2020/ferguson2/ioccc-and-chocolate.pdf differ diff --git a/2020/ferguson2/recode.html b/2020/ferguson2/recode.html deleted file mode 100644 index 207cf2fcc..000000000 --- a/2020/ferguson2/recode.html +++ /dev/null @@ -1,616 +0,0 @@ - - - - - - - - - - - -

The recode configurator documentation (and a fun way to explore my 2020 IOCCC Enigma simulator)

- -

N.B. At the end of this file I have given a fun exercise that can be used to -explore my Enigma simulator. It’s especially worth doing if you you like -good chocolate and could use a delicious Double-layered Chocolate Fudge Cake.

- -

Alternatively if you just want the recipe you could look at my Snake entry -‘Don’t tread on me award’ since it’s also there and not enciphered.

- -

- - - -

What is recode and why is it recommended?

- -

To demonstrate how to and why you should use the recode program with the Enigma -simulator I have included some examples here as well as brief (‘brief?!’ I am sure -many would think but it’s brief for me) commentary.

- -

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.

- -

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 if piped to the simulator) etc.

- -

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 (labelling them with -the Roman numeral), the reflectors (labelling them with B, C and showing the -actual strings) etc.

- -

In this file I will show an example of each feature and then get to the -wonderful ‘challenge’ for everyone.

- -

Options

- -
    usage: ./recode [options]
-    -v          display selected settings
-    -r          pseudo-randomly select settings
-    -f<input file>  read file for Enigma input
-    -R<string|file> init settings from settings string or file
-    -o<output file> write settings to file
-
- -

-r 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.

- -

-v shows selected settings. For example combining -r and -v:

- -
    $ echo IOCCC | ./recode -r -v
-    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
-    Ring 2: (  V) VZBRGITYUPSDNHLXAWMJQOFECK
-    Ring 3: ( IV) ESOVPZJAYQUIRHXLNFTGKDCMWB
-    Ring  settings: WAR
-    Ring positions: XKE
-    Reflector: (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
-    Plugboard pair #01: XE
-    Plugboard pair #02: HJ
-    Plugboard pair #03: SA
-    Plugboard pair #04: PY
-    Plugboard pair #05: CI
-    Plugboard pair #06: ZB
-    Plugboard pair #07: WD
-    Plugboard pair #08: QN
-    Plugboard pair #09: RU
-    Plugboard pair #10: VG
-    1WX5AK4RE1XEHJSAPYCIZBWDQNRUVGIOCCC
-
- -

Though you won’t find such strings in recode.c or prog.c. (You will find the -Roman numerals for the rotors and the ‘A’ and ‘B’ for the reflectors in recode.c -though). Yes the ‘WAR’ for the Ringstellung (Ring settings) is an amusing -coincidence but it really did happen!

- -

As for -f the contents would be output with the settings e.g. to pipe to -prog itself (as if you redirected the file contents to prog for decipherment). -If the file cannot be opened it sets back to stdin.

- -

-o 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:

- -
    $ ./recode -r -oconfig
-    IOCCC
-    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC
-    $ cat config
-    3PP4UB5GG1ELGTKFCOPVBNUYXJAWSD$
-
- -

Notice that a terminating newline isn’t added. Also note that it outputs to -stdout so you can pipe it to prog 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).

- -

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 -R<settings> 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 nor anything but the direct output of a previous run (thus -validated). I’m not even guaranteeing that I got the array tests valid in -recode.c -R option!

- -

Protecting against the same I/O file

- -

Because some file systems are case-insensitive I have implemented a -case-insensitive strcmp(); 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 stat() 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?

- -

File options parser limitation

- -

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:

- -
$ ./recode -R~/config
-
- -

Will not read the file ‘config’ in the home directory. I show another way to -achieve this later.

- -

This limitation also applies to the -f and -o options!

- -

-R option validation?

- -

Again the -R option does not validate input. For validation you have to run -the program interactively.

- -

Piping commands to recode

- -

If stdin is not a tty (!isatty(0)) and neither randomised mode nor reading in -from a file is specified then you might just see something like:

- -
    $ echo testing test tests | ./recode
-    1AB2BB3CC1testing test tests
-
-    $ echo testing test tests | ./recode | ./prog - 2>/dev/null
-    mfrwxan lzng ofnlu
-
-    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode
-    1AB2BB3CC1mfrwxan lzng ofnlu
-
-    $ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null
-    testing test tests
-
- -

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).

- -

Piping recode to the Enigma simulator

- -

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:

- -
    $ ./recode -r | ./prog -
-    Ring 1: IOCCC
-    Setting 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
-
- -

What happened is that Ring 1: is printed to stderr but since it’s not been -redirected to /dev/null 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.

- -

Manually test the recode program with the Enigma program

- -
    $ cat input
-    IOCCC
-
-    $ ./recode -finput
-    Rotors:
-    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
-    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
-    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
-    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
-    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
-    Input rotor 1 (1 - 5): 1
-    Input rotor 2 (1 - 5): 2
-    Input rotor 3 (1 - 5): 3
-    Input setting 1 (A - Z): A
-    Input setting 2 (A - Z): A
-    Input setting 3 (A - Z): A
-    Input position 1 (A - Z): A
-    Input position 2 (A - Z): A
-    Input position 3 (A - Z): A
-    Reflector:
-    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
-    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
-    Input reflector (1 - 2): 2
-    Input plugboard pair 1: AB
-    Input plugboard pair 2: CD
-    Input plugboard pair 3: ..
-    Input plugboard pair 4: EF
-    Input plugboard pair 5: GH
-    Input plugboard pair 6: IJ
-    Input plugboard pair 7: KL
-    Input plugboard pair 8: MN
-    Input plugboard pair 9: OP
-    Input plugboard pair 10: QR
-    1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC
-
- -

Notice that I skipped a plugboard pair; 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 simulator.

- -
    $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
-    HQNVO
-    $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC  | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog  - 2>/dev/null
-    IOCCC
-
- -

As you can see the recode 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 HQNVO.

- -

Following this I piped the original output (of recode) 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 -R option to greatly simplify things.)

- -

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.

- -

What happens if the plugboard pairs are the same but in a different order? It’s -the same output:

- -
    $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
-    HQNVO
-
- -

Also if you flip the order of the letters in the pair e.g. the AB as BA instead:

- -
    $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
-    HQNVO
-
- -

Only write config file

- -
    $ ./recode -v -oconfig -finput >/dev/null
-    Rotors:
-    (1)   I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
-    (2)  II: AJDKSIRUXBLHWTMCQGZNPYFVOE
-    (3) III: BDFHJLCPRTXVZNYEIWGAKMUSQO
-    (4)  IV: ESOVPZJAYQUIRHXLNFTGKDCMWB
-    (5)   V: VZBRGITYUPSDNHLXAWMJQOFECK
-    Input rotor 1 (1 - 5): 1
-    Input rotor 2 (1 - 5): 2
-    Input rotor 3 (1 - 5): 3
-    Input setting 1 (A - Z): A
-    Input setting 2 (A - Z): C
-    Input setting 3 (A - Z): E
-    Input position 1 (A - Z): B
-    Input position 2 (A - Z): D
-    Input position 3 (A - Z): F
-    Reflector:
-    (1) (B) YRUHQSLDPXNGOKMIEBFZCWVJAT
-    (2) (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
-    Input reflector (1 - 2): 2
-    Input plugboard pair 1: AB
-    Input plugboard pair 2: CD
-    Input plugboard pair 3: EF
-    Input plugboard pair 4: GHIJ
-    Input plugboard pair 5: IJ
-    Input plugboard pair 6: KL
-    Input plugboard pair 7: MN
-    Input plugboard pair 8: OP
-    Input plugboard pair 9: QR
-    Input plugboard pair 10: ST
-    Ring 1: (  I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
-    Ring 2: ( II) AJDKSIRUXBLHWTMCQGZNPYFVOE
-    Ring 3: (III) BDFHJLCPRTXVZNYEIWGAKMUSQO
-    Ring  settings: ACE
-    Ring positions: BDF
-    Reflector: (C) FVPJIAOYEDRZXWGCTKUQSBNMHL
-    Plugboard pair #01: AB
-    Plugboard pair #02: CD
-    Plugboard pair #03: EF
-    Plugboard pair #04: GH
-    Plugboard pair #05: IJ
-    Plugboard pair #06: KL
-    Plugboard pair #07: MN
-    Plugboard pair #08: OP
-    Plugboard pair #09: QR
-    Plugboard pair #10: ST
-
- -

Notice that I redirect stdout to /dev/null so that the config is only written to -the file config. But also notice that for plugboard pair 4 I typed in GHIJ and -it didn’t report an error. Neither did it complain about IJ in the next pair. -This is because it consumes input overflow.

- -

It shouldn’t be this way for the simulator though because that could cause -inconsistent number of characters expected before the text to encipher.

- -
    $ cat config
-    1AB2CD3EF2ABCDEFGHIJKLMNOPQRST
-
-    $ ( cat config ; cat input ) | ./prog - 2>/dev/null
-    LRAVE
-
-    $ ( cat config ; cat input ) | ./prog - 2>/dev/null | ( cat config ; echo LRAVE ) | ./prog  - 2>/dev/null
-    IOCCC
-
- -

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.

- -

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):

- -
    $ echo | ./recode -r -osettings
-    $ echo -n | ./recode -r -osettings
-    $ > empty
-    $ ./recode -r -osettings < empty
-    $ cat empty | ./recode -r -osettings
-    $ ./recode -r -osettings
-    ^D
-
- -

(Above ^D was not shown but I typed it.) The way it works: if nothing is read -the buffer remains NULL and so I don’t print it but still do print the settings -file. Actually even if getdelim() fails you’re supposed to free the buffer so I -set another variable to indicate if it should be printed.

- -

Reusing a configuration

- -
    $ echo -n|./recode -r -oconfig
-    4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
-
-    $ cat input.txt
-    IOCCC 2020 Enigma simulator example text file
-
-    This is a sentence.
-
-    This is another sentence.
-
-    $ ( cat config ; cat input.txt  ) | ./prog - 2>/dev/null > output
-    $ cat output
-    AAPRT 2020 Dkemny tpgnjsjai xpovrgl jvgs wxra
-
-    Fytt ly m xyiilaqh.
-
-    Ybbp ox dmuzerm oscwgytb.
-    $ ( cat config ; cat output ) | ./prog  - 2>/dev/null > io
-    $ diff io input.txt
-    $
-
- -

Alternatively you can just use the -R and -f options:

- -
    $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
-    $ diff output output2
-    $
-
- -

Write config file, read data file and pass to Enigma simulator

- -
    $ ./recode -finput.txt -oconfig | ./prog - 2>/dev/null > 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
-
- -

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). But what matters is the output:

- -
    $ cat output
-    DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf
-
-    Jsjy ce v pxdmullo.
-
-    Sara tj rtaayak uxfhjcti.
-
-    $ ./recode -Rconfig -foutput | ./prog - 2>/dev/null
-    IOCCC 2020 Enigma simulator example text file
-
-    This is a sentence.
-
-    This is another sentence.
-
- -

Piping directly to the Enigma code once (with randomised settings, saved)

- -

This is like the above only randomised:

- -
    $ ./recode -r -oconfig|./prog - 2>/dev/null
-    IOCCC
-    UGEVP
-
- -

Note that I typed in IOCCC and sent EOF (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:

- -
    $ cat config
-    2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ
-
- -

Without having to copy/paste intermediate results:

- -
    $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
-    IOCCC
-
- -

You can also use a string for the -R option. I’ll use command substitution and -actual pasting to demonstrate:

- -
    $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
-    IOCCC
-
- -

Usage conclusion

- -

That should give you an idea of how to use the recode 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).

- -

Example additions

- -
    -
  • Add code (to prog.c) that tries to determine possible decipherments based on -a given crib (or set of cribs).
  • -
- - -

Example uses

- -
    -
  • 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).

  • -
  • 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?

  • -
  • Best idea: try the below experiment!

  • -
- - -

Deliciously Enigmatic: Double-layered Chocolate Fudge Cake

- -

As I was making the above silly list something occurred to me. My other entries -this year include 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?

- -

So this is what I offer: if you take one of the settings below and run the -simulator on the file chocolate-cake.html 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 just go and look at my other entry. Then again if you’re lazy you’re -probably not reading this far! :)

- -

The settings is one of the below but a couple questions you might ask yourself:

- -
    -
  1. Are any invalid input?

  2. -
  3. Is there some other kind of trickery involved here?

  4. -
- - -

I can think of the best way to answer these and I think I need not even mention -it. Have fun and enjoy! 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.

- -

Hints:

- -
    -
  1. It’s not the middle one.

  2. -
  3. 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.

  4. -
  5. 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.)

  6. -
  7. The above points might or might not be relevant. What is relevant is one -will reveal a wonderful Double-layered Chocolate Fudge Cake recipe:

    - -
       142CHOCOLATESVCAKESTBJLKMUMVWX
    -   0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI
    -   3UY0XF4QG1GTJQLARPKHBEMCOFVUIN
    -   0WE1HK4PL0RVSGXFDKENZYTPCMAHUW
    -   2LV0KC1IE0HTFPCLWOJDBQIRVMEAGN
    -   1SS4QX2RY1SRAQGKUYHCBLPFJDVTNZ
    -   3IW1QR0TZ0GQEDWIYJUPMFZBRAONHS
    -   3OP1KN4MO0HPFZCEAKYQIRXGVMOTUW
    -   4OC2CC0AK1CODELUVRSNGKIZBJPTMY
    -   4MU0MS1CA1KELUVRSXTABJNOCDMQFG
    -   0MU4MC2HO1CLATEFBJMONPQRVWXYZD
    -   125CHOCOLATESEXCAKESJADFNOPQRS
    -   0CH3OC1OL1ATEMBJNOCDLSIFWHRVXY
    -   4MU1MS3CA0KECHOLATBJSNPXVUFGZY
    -   4VW0SL1YB0IYJSLBECKTNAXGPUVHRF
    -   0MC4OH2CO1LATEUMBJCDFGHINOPRQS
    -
  8. -
- - -

BTW: What’s the middle of a list with even numbered items anyway?

-
-
- - - - -
Creative Commons License

© Copyright 1984-2020, -Leo Broukhis, Simon Cooper, Landon Curt Noll -- All rights reserved
-This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

 
- - diff --git a/2020/ferguson2/try.alt.sh b/2020/ferguson2/try.alt.sh new file mode 100755 index 000000000..2b1fbe45e --- /dev/null +++ b/2020/ferguson2/try.alt.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2020/ferguson2 +# +# I, Cody Boone Ferguson, want to dedicate this entry in part to the millions of +# poor souls that were lost during the tragedy that is the Second World War. +# There are so many people who are unknown, unloved, unclaimed and even +# unidentified. And who knows what they might have gone on to do if their lives +# weren't - like it is with all other wars - needlessly taken from them? When +# one considers it was all because the most powerful man in the world at the +# time felt he should rule all others it makes it somehow even more tragic: +# there wasn't even a good reason for the war (is there ever?). +# +# If one were to write the name of every person who died in the conflict in a +# book, it would take so many pages that the book would be so heavy, so long, so +# expensive to print and it wouldn't bring anyone back to life nor would it erase +# the suffering. Nothing will. It's horrible. +# +# There really are no words that can truly describe the tragedy but I wish to +# with my Enigma simulator honour each and every soul who was lost, or suffered, +# or suffered the loss of friends or loved ones, as well as the world itself, in +# and from one of the greatest tragedies in the history of mankind. +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" alt >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +# IOCCC obfuscated! +read -r -n 1 -p "Press any key to encrypt IOCCC with default settings: " +echo 1>&2 +echo "$ echo IOCCC | ./prog.alt" 1>&2 +echo IOCCC | ./prog.alt +echo 1>&2 + +# IOCCC obfuscated and de-obfuscated!: +read -r -n 1 -p "Press any key to encrypt and then decrypt IOCCC with default settings: " +echo 1>&2 +echo "$ echo IOCCC | ./prog | ./prog.alt" 1>&2 +echo IOCCC | ./prog | ./prog.alt +echo 1>&2 + +# more input fun: +read -r -n 1 -p "Press any key to show try.this.txt: " +echo 1>&2 +echo "$ cat try.this.txt" 1>&2 +cat try.this.txt +read -r -n 1 -p "Press any key to encrypt text of try.this.txt with its own settings: " +echo 1>&2 +echo "$ ./prog.alt - < try.this.txt 2>/dev/null" 1>&2 +echo 1>&2 +./prog.alt - < try.this.txt 2>/dev/null +echo 1>&2 + +# more obfuscated fun: +read -r -n 1 -p "Press any key to send 'testing test tests' to recode: " +echo 1>&2 +echo "$ echo testing test tests | ./recode" 1>&2 +echo testing test tests | ./recode +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog.alt: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog.alt - 2>/dev/null" 1>&2 +echo testing test tests | ./recode | ./prog.alt - 2>/dev/null +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode" 1>&2 +echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode -> prog.alt: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog.alt - 2>/dev/null" 1>&2 +echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog.alt - 2>/dev/null +echo 1>&2 + +# even more obfuscated fun saving and reading from files: +# +# initial clean up: +rm -f conf input output output2 +# encrypt "testing test tests" with randomised settings saved in conf, saving +# original string to input and original output to output: +read -r -n 1 -p "Press any key to save settings and output, then encrypt: " +echo 1>&2 +echo "$ echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output" 1>&2 +echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output +read -r -n 1 -p "Press any key to show input file: " +echo 1>&2 +cat input +echo 1>&2 +read -r -n 1 -p "Press any key to show output file: " +echo 1>&2 +cat output +echo 1>&2 +# configure Enigma machine from conf file and read from output file, thus decrypting: +read -r -n 1 -p "Press any key to decrypt the output from the above command: " +echo 1>&2 +echo "$ ./recode -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 +./recode -Rconf -foutput | ./prog - 2>/dev/null > output2 +read -r -n 1 -p "Press any key to show output2: " +echo 1>&2 +cat output2 +read -r -n 1 -p "Press any key to show input again: " +echo 1>&2 +cat input +echo 1>&2 +# make sure input and output2 are the same: +read -r -n 1 -p "Press any key to compare input and output2: " +echo 1>&2 +diff -s input output2 +diff -s input output2 +# final clean up +rm -f conf input output output2 diff --git a/2020/ferguson2/try.sh b/2020/ferguson2/try.sh new file mode 100755 index 000000000..2d70f4f2c --- /dev/null +++ b/2020/ferguson2/try.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2020/ferguson2 +# +# I, Cody Boone Ferguson, want to dedicate this entry in part to the millions of +# poor souls that were lost during the tragedy that is the Second World War. +# There are so many people who are unknown, unloved, unclaimed and even +# unidentified. And who knows what they might have gone on to do if their lives +# weren't - like it is with all other wars - needlessly taken from them? When +# one considers it was all because the most powerful man in the world at the +# time felt he should rule all others it makes it somehow even more tragic: +# there wasn't even a good reason for the war (is there ever?). +# +# If one were to write the name of every person who died in the conflict in a +# book, it would take so many pages that the book would be so heavy, so long, so +# expensive to print and it wouldn't bring anyone back to life nor would it erase +# the suffering. Nothing will. It's horrible. +# +# There really are no words that can truly describe the tragedy but I wish to +# with my Enigma simulator honour each and every soul who was lost, or suffered, +# or suffered the loss of friends or loved ones, as well as the world itself, in +# and from one of the greatest tragedies in the history of mankind. +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +# IOCCC obfuscated! +read -r -n 1 -p "Press any key to encrypt IOCCC with default settings: " +echo 1>&2 +echo "$ echo IOCCC | ./prog" 1>&2 +echo IOCCC | ./prog +echo 1>&2 + +# IOCCC obfuscated and de-obfuscated!: +read -r -n 1 -p "Press any key to encrypt and then decrypt IOCCC with default settings: " +echo 1>&2 +echo "$ echo IOCCC | ./prog | ./prog" 1>&2 +echo IOCCC | ./prog | ./prog +echo 1>&2 + +# more input fun: +read -r -n 1 -p "Press any key to show try.this.txt: " +echo 1>&2 +echo "$ cat try.this.txt" 1>&2 +cat try.this.txt +read -r -n 1 -p "Press any key to encrypt text of try.this.txt with its own settings: " +echo 1>&2 +echo "$ ./prog - < try.this.txt 2>/dev/null" 1>&2 +echo 1>&2 +./prog - < try.this.txt 2>/dev/null +echo 1>&2 + +# more obfuscated fun: +read -r -n 1 -p "Press any key to send 'testing test tests' to recode: " +echo 1>&2 +echo "$ echo testing test tests | ./recode" 1>&2 +echo testing test tests | ./recode +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null" 1>&2 +echo testing test tests | ./recode | ./prog - 2>/dev/null +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode" 1>&2 +echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode +echo 1>&2 + +read -r -n 1 -p "Press any key to send 'testing test tests' to recode -> prog -> recode -> prog: " +echo 1>&2 +echo "$ echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null" 1>&2 +echo testing test tests | ./recode | ./prog - 2>/dev/null | ./recode | ./prog - 2>/dev/null +echo 1>&2 + +# even more obfuscated fun saving and reading from files: +# +# initial clean up: +rm -f conf input output output2 +# encrypt "testing test tests" with randomised settings saved in conf, saving +# original string to input and original output to output: +read -r -n 1 -p "Press any key to save settings and output, then encrypt: " +echo 1>&2 +echo "$ echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output" 1>&2 +echo testing test tests | tee input | ./recode -r -oconf | ./prog - 2>/dev/null >output +read -r -n 1 -p "Press any key to show input file: " +echo 1>&2 +cat input +echo 1>&2 +read -r -n 1 -p "Press any key to show output file: " +echo 1>&2 +cat output +echo 1>&2 +# configure Enigma machine from conf file and read from output file, thus decrypting: +read -r -n 1 -p "Press any key to decrypt the output from the above command: " +echo 1>&2 +echo "$ ./recode -Rconf -foutput | ./prog - 2>/dev/null > output2" 1>&2 +./recode -Rconf -foutput | ./prog - 2>/dev/null > output2 +read -r -n 1 -p "Press any key to show output2: " +echo 1>&2 +cat output2 +read -r -n 1 -p "Press any key to show input again: " +echo 1>&2 +cat input +echo 1>&2 +# make sure input and output2 are the same: +read -r -n 1 -p "Press any key to compare input and output2: " +echo 1>&2 +diff -s input output2 +diff -s input output2 +# final clean up +rm -f conf input output output2 diff --git a/thanks-for-help.md b/thanks-for-help.md index 20519e210..aa8246a0d 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -4368,6 +4368,11 @@ and I encourage you to do so as the cake is quite picky! [Cody](#cody), with intentional irony here :-), fixed formatting, links and typos in various files. +He also added the [try.sh](/2020/ferguson2/try.sh) script. + +He also added the [alt code](/2020/ferguson2/README.md#alternate-code) and the +[try.alt.sh](/2020/ferguson2/try.alt.sh) script. + He also fixed some issues that occurred when files were renamed to `.md` from `.markdown`.
- IOCCC -

The International Obfuscated C Code Contest

-
-

Supplemental Info

-