From: Neil Smith Date: Fri, 18 Oct 2019 16:00:18 +0000 (+0100) Subject: Done 2019 challenge 2 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=6636f0fdbfd6164cf130a0731d58b90528ef6761;p=cipher-tools.git Done 2019 challenge 2 --- diff --git a/2019/2019-challenge2.ipynb b/2019/2019-challenge2.ipynb new file mode 100644 index 0000000..4ec93e1 --- /dev/null +++ b/2019/2019-challenge2.ipynb @@ -0,0 +1,172 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import os,sys,inspect\n", + "currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n", + "parentdir = os.path.dirname(currentdir)\n", + "sys.path.insert(0,parentdir) " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "from cipher.caesar import *\n", + "from cipher.affine import *\n", + "from support.text_prettify import *" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "ca = open('2a.ciphertext').read()\n", + "cb = open('2b.ciphertext').read()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "11 7 True \n", + "\n", + "Meg, I took a look at the file you sent over and it was just a rotation cipher applied to the text.\n", + "At first it was hard to say if that was a bug or a feature and normally I would assume bug, but it\n", + "seemed odd that it was the only file that was affected so I asked around to see if anyone had seen\n", + "anything similar. It turns out that this was not the first navigation problem to hit the programme.\n", + "Gene reported a major issue with the guidance programme for Snoopy on the Apollo Ten mission which\n", + "could again have caused a major problem. For some reason the programme controlling the landing radar\n", + "wasn’t updated with the flight plan and if Gene hadn’t raised that with Iverson then the boys might\n", + "have had real trouble getting back. I looked through the company files and found another of our\n", + "mysteriously formatted reports: the memo informing them about the change, which explains why the\n", + "programme never got updated. This time the cipher was an affine shift, so slightly harder to crack,\n", + "but nothing serious. Still, it is much less likely that it was a bug that time, and in any case\n", + "twice is too much of a coincidence. It did start me wondering why the second cipher was easier to\n", + "crack than the first, but then I realised that the affine shift was too much of a giveaway. A\n", + "rotation cipher really could just be an encoding error, but the affine shift is too sophisticated\n", + "for a mistake, so whoever mangled the reports must have realised they had made a bit of an error\n", + "with the first one and tried to cover their steps with the second. It is hard to see this as\n", + "anything other than attempted sabotage, but I am not sure what the motive could be. I doubt it is\n", + "personal. The Apollo Ten and Eleven crews don’t overlap, so either someone has a grudge against the\n", + "whole Astronaut corps or they are trying to derail the Apollo programme. It could be the Soviets I\n", + "suppose. At first, I thought that their willingness to shift the LUNA-FIFTEEN orbit showed that they\n", + "weren’t part of it, but someone in the State Department pointed out that they might just have had a\n", + "guilty conscience, or been keen to distance themselves once the plot was discovered. I am still not\n", + "sure. In the meantime, could you take a look at the computer files to see who might have had access\n", + "to both memos, and who might have had the opportunity and means to doctor them? I am flying back to\n", + "Langley tonight, to see if the State Department have any ideas what might be going on. Neil said he\n", + "could fly me up in one of the NASA chase planes, which is something I have been keen to try. I will\n", + "call you if I get anything.\n" + ] + }, + { + "data": { + "text/plain": [ + "2592" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(m_a, s_a, o_a), score_a = affine_break(ca)\n", + "print(m_a, s_a, o_a, '\\n')\n", + "print(lcat(tpack(affine_decipher(ca, m_a, s_a, o_a).split())))\n", + "open('2a.plaintext', 'w').write(lcat(tpack(affine_decipher(ca, m_a, s_a, o_a).split())))" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3 8 True \n", + "\n", + "Apollo Ten\n", + "Spacecraft Operational Trajectory\n", + "First Revision\n", + "This document contains updated information about the planned lunar orbital operations for the mission and has been compiled to satisfy flight crew/flight controller training and simulation requirements.\n", + "\n", + "The following mission phases remain UNCHANGED from the original plan:\n", + "Launch, which ends with insertion into earth parking orbit (EPO).\n", + "Earth orbit coast, which ends with Translunar Injection (TLI).\n", + "Trans Lunar coast, which ends with Lunar Orbit Insertion (LOI).\n", + "Trans Earth coast, which ends with re-entry into the mid-Pacific recovery area.\n", + "\n", + "The total mission duration will be approximately EIGHT days.\n", + "\n", + "The report includes significant changes to Lunar orbital operations, which start at LOI and end with Trans Earth lnjection. NOTE THESE IMPORTANT TRAJECTORY CHANGES\n", + "\n", + "The prime objective of the LOI-TEI phase will be to demonstrate all\n", + "components of Mission G except those which directly involve Lunar Module powered descent and powered ascent.\n", + "\n" + ] + }, + { + "data": { + "text/plain": [ + "1012" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(m_b, s_b, o_b), score_a = affine_break(cb)\n", + "print(m_b, s_b, o_b, '\\n')\n", + "print(affine_decipher(cb, m_b, s_b, o_b))\n", + "open('2b.plaintext', 'w').write(affine_decipher(cb, m_b, s_b, o_b))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/2019/2a.ciphertext b/2019/2a.ciphertext new file mode 100644 index 0000000..9d9954b --- /dev/null +++ b/2019/2a.ciphertext @@ -0,0 +1 @@ +Tjf, B sppx r ippx rs sqj ubij vpd hjes pojw rey bs zrh mdhs r wpsrsbpe nbaqjw raaibjy sp sqj sjks. Rs ubwhs bs zrh qrwy sp hrv bu sqrs zrh r cdf pw r ujrsdwj rey epwtriiv B zpdiy rhhdtj cdf, cds bs hjjtjy pyy sqrs bs zrh sqj peiv ubij sqrs zrh ruujnsjy hp B rhxjy rwpdey sp hjj bu revpej qry hjje revsqbef hbtbirw. Bs sdweh pds sqrs sqbh zrh eps sqj ubwhs erobfrsbpe awpcijt sp qbs sqj awpfwrttj. Fjej wjapwsjy r trmpw bhhdj zbsq sqj fdbyrenj awpfwrttj upw Heppav pe sqj Rapiip Sje tbhhbpe zqbnq npdiy rfrbe qroj nrdhjy r trmpw awpcijt. Upw hptj wjrhpe sqj awpfwrttj npeswpiibef sqj ireybef wryrw zrhe’s dayrsjy zbsq sqj uibfqs aire rey bu Fjej qrye’s wrbhjy sqrs zbsq Bojwhpe sqje sqj cpvh tbfqs qroj qry wjri swpdcij fjssbef crnx. B ippxjy sqwpdfq sqj nptarev ubijh rey updey repsqjw pu pdw tvhsjwbpdhiv upwtrssjy wjapwsh: sqj tjtp beupwtbef sqjt rcpds sqj nqrefj, zqbnq jkairbeh zqv sqj awpfwrttj ejojw fps dayrsjy. Sqbh sbtj sqj nbaqjw zrh re ruubej hqbus, hp hibfqsiv qrwyjw sp nwrnx, cds epsqbef hjwbpdh. Hsbii, bs bh tdnq ijhh ibxjiv sqrs bs zrh r cdf sqrs sbtj, rey be rev nrhj szbnj bh spp tdnq pu r npbenbyjenj. Bs yby hsrws tj zpeyjwbef zqv sqj hjnpey nbaqjw zrh jrhbjw sp nwrnx sqre sqj ubwhs, cds sqje B wjribhjy sqrs sqj ruubej hqbus zrh spp tdnq pu r fbojrzrv. R wpsrsbpe nbaqjw wjriiv npdiy mdhs cj re jenpybef jwwpw, cds sqj ruubej hqbus bh spp hpaqbhsbnrsjy upw r tbhsrxj, hp zqpjojw trefijy sqj wjapwsh tdhs qroj wjribhjy sqjv qry tryj r cbs pu re jwwpw zbsq sqj ubwhs pej rey swbjy sp npojw sqjbw hsjah zbsq sqj hjnpey. Bs bh qrwy sp hjj sqbh rh revsqbef psqjw sqre rssjtasjy hrcpsrfj, cds B rt eps hdwj zqrs sqj tpsboj npdiy cj. B ypdcs bs bh ajwhperi. Sqj Rapiip Sje rey Jijoje nwjzh ype’s pojwira, hp jbsqjw hptjpej qrh r fwdyfj rfrbehs sqj zqpij Rhswperds npwah pw sqjv rwj swvbef sp yjwrbi sqj Rapiip awpfwrttj. Bs npdiy cj sqj Hpobjsh B hdaaphj. Rs ubwhs, B sqpdfqs sqrs sqjbw zbiibefejhh sp hqbus sqj IDER-UBUSJJE pwcbs hqpzjy sqrs sqjv zjwje’s arws pu bs, cds hptjpej be sqj Hsrsj Yjarwstjes apbesjy pds sqrs sqjv tbfqs mdhs qroj qry r fdbisv npehnbjenj, pw cjje xjje sp ybhsrenj sqjthjiojh penj sqj aips zrh ybhnpojwjy. B rt hsbii eps hdwj. Be sqj tjresbtj, npdiy vpd srxj r ippx rs sqj nptadsjw ubijh sp hjj zqp tbfqs qroj qry rnnjhh sp cpsq tjtph, rey zqp tbfqs qroj qry sqj paapwsdebsv rey tjreh sp ypnspw sqjt? B rt uivbef crnx sp Irefijv spebfqs, sp hjj bu sqj Hsrsj Yjarwstjes qroj rev byjrh zqrs tbfqs cj fpbef pe. Ejbi hrby qj npdiy uiv tj da be pej pu sqj ERHR nqrhj airejh, zqbnq bh hptjsqbef B qroj cjje xjje sp swv. B zbii nrii vpd bu B fjs revsqbef. diff --git a/2019/2a.plaintext b/2019/2a.plaintext new file mode 100644 index 0000000..ba8289c --- /dev/null +++ b/2019/2a.plaintext @@ -0,0 +1,27 @@ +Meg, I took a look at the file you sent over and it was just a rotation cipher applied to the text. +At first it was hard to say if that was a bug or a feature and normally I would assume bug, but it +seemed odd that it was the only file that was affected so I asked around to see if anyone had seen +anything similar. It turns out that this was not the first navigation problem to hit the programme. +Gene reported a major issue with the guidance programme for Snoopy on the Apollo Ten mission which +could again have caused a major problem. For some reason the programme controlling the landing radar +wasn’t updated with the flight plan and if Gene hadn’t raised that with Iverson then the boys might +have had real trouble getting back. I looked through the company files and found another of our +mysteriously formatted reports: the memo informing them about the change, which explains why the +programme never got updated. This time the cipher was an affine shift, so slightly harder to crack, +but nothing serious. Still, it is much less likely that it was a bug that time, and in any case +twice is too much of a coincidence. It did start me wondering why the second cipher was easier to +crack than the first, but then I realised that the affine shift was too much of a giveaway. A +rotation cipher really could just be an encoding error, but the affine shift is too sophisticated +for a mistake, so whoever mangled the reports must have realised they had made a bit of an error +with the first one and tried to cover their steps with the second. It is hard to see this as +anything other than attempted sabotage, but I am not sure what the motive could be. I doubt it is +personal. The Apollo Ten and Eleven crews don’t overlap, so either someone has a grudge against the +whole Astronaut corps or they are trying to derail the Apollo programme. It could be the Soviets I +suppose. At first, I thought that their willingness to shift the LUNA-FIFTEEN orbit showed that they +weren’t part of it, but someone in the State Department pointed out that they might just have had a +guilty conscience, or been keen to distance themselves once the plot was discovered. I am still not +sure. In the meantime, could you take a look at the computer files to see who might have had access +to both memos, and who might have had the opportunity and means to doctor them? I am flying back to +Langley tonight, to see if the State Department have any ideas what might be going on. Neil said he +could fly me up in one of the NASA chase planes, which is something I have been keen to try. I will +call you if I get anything. \ No newline at end of file diff --git a/2019/2b.ciphertext b/2019/2b.ciphertext new file mode 100644 index 0000000..e642ff8 --- /dev/null +++ b/2019/2b.ciphertext @@ -0,0 +1,17 @@ +Kdarra Pwx +Mdkqwqjkzp Adwjkpiaxkr Pjklwqpaje +Zijmp Jwvimiax +Pfim taqsuwxp qaxpkixm sdtkpwt ixzajukpiax knasp pfw drkxxwt rsxkj ajnipkr adwjkpiaxm zaj pfw uimmiax kxt fkm nwwx qaudirwt pa mkpimze zricfp qjwy/zricfp qaxpjarrwj pjkixixc kxt miusrkpiax jwgsijwuwxpm. + +Pfw zarrayixc uimmiax dfkmwm jwukix SXQFKXCWT zjau pfw ajicixkr drkx: +Rksxqf, yfiqf wxtm yipf ixmwjpiax ixpa wkjpf dkjoixc ajnip (WDA). +Wkjpf ajnip qakmp, yfiqf wxtm yipf Pjkxmrsxkj Ixlwqpiax (PRI). +Pjkxm Rsxkj qakmp, yfiqf wxtm yipf Rsxkj Ajnip Ixmwjpiax (RAI). +Pjkxm Wkjpf qakmp, yfiqf wxtm yipf jw-wxpje ixpa pfw uit-Dkqiziq jwqavwje kjwk. + +Pfw papkr uimmiax tsjkpiax yirr nw kddjabiukpwre WICFP tkem. + +Pfw jwdajp ixqrstwm micxiziqkxp qfkxcwm pa Rsxkj ajnipkr adwjkpiaxm, yfiqf mpkjp kp RAI kxt wxt yipf Pjkxm Wkjpf rxlwqpiax. XAPW PFWMW IUDAJPKXP PJKLWQPAJE QFKXCWM + +Pfw djiuw anlwqpivw az pfw RAI-PWI dfkmw yirr nw pa twuaxmpjkpw krr +qaudaxwxpm az Uimmiax C wbqwdp pfamw yfiqf tijwqpre ixvarvw Rsxkj Uatsrw daywjwt twmqwxp kxt daywjwt kmqwxp. diff --git a/2019/2b.plaintext b/2019/2b.plaintext new file mode 100644 index 0000000..cbe2084 --- /dev/null +++ b/2019/2b.plaintext @@ -0,0 +1,17 @@ +Apollo Ten +Spacecraft Operational Trajectory +First Revision +This document contains updated information about the planned lunar orbital operations for the mission and has been compiled to satisfy flight crew/flight controller training and simulation requirements. + +The following mission phases remain UNCHANGED from the original plan: +Launch, which ends with insertion into earth parking orbit (EPO). +Earth orbit coast, which ends with Translunar Injection (TLI). +Trans Lunar coast, which ends with Lunar Orbit Insertion (LOI). +Trans Earth coast, which ends with re-entry into the mid-Pacific recovery area. + +The total mission duration will be approximately EIGHT days. + +The report includes significant changes to Lunar orbital operations, which start at LOI and end with Trans Earth lnjection. NOTE THESE IMPORTANT TRAJECTORY CHANGES + +The prime objective of the LOI-TEI phase will be to demonstrate all +components of Mission G except those which directly involve Lunar Module powered descent and powered ascent.