From: Neil Smith Date: Thu, 5 Oct 2017 14:24:12 +0000 (+0100) Subject: Added 2017 challenge 1 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=881e6da407d16c42b13458764f7531e8ba578f23;p=cipher-tools.git Added 2017 challenge 1 --- diff --git a/2017/1a.ciphertext b/2017/1a.ciphertext new file mode 100644 index 0000000..4b9d9c5 --- /dev/null +++ b/2017/1a.ciphertext @@ -0,0 +1,4 @@ +HVMTVH, +DO DN BMZVO OJ CZVM AMJH TJP. RZ YDY KDXF PK NJHZ XCVOOZM V XJPKGZ JA HJIOCN VBJ VIY E RVN HZIODJIZY OCZMZ OJJ, NJ RZ VGMZVYT CVQZ V ADGZ JI CZM. CZM IVHZ DN EJYDZ VIY NCZ RJMFN VN GDVDNJI WZORZZI OCZ WMDODNC GDWMVMT VIY OCZ WMDODNC HPNZPH, MZNZVMXCDIB GDIFN WZORZZI VMOZAVXON VIY DHKZMDVG MJHVI OZSON, NJ OCVO ODZN DI RDOC OCZ DIOZGGDBZIXZ TJP CVQZ WZZI MZXZDQDIB. IJOCDIB NPBBZNON OCVO NCZ CVN WZZI DIQJGQZY DI VITOCDIB NCVYT VIY NCZ CVN CZGKZY RDOC NZQZMVG DINPMVIXZ AMVPY XVNZN. NCZ CVN VI DIOZMZNODIB WVXFBMJPIY. NCZ YDY V KCY JI CPHVI HDBMVODJI NOPYDZN, HVDIGT HVOCZHVODXVG HJYZGGDIB, OCZI HJQZY JI OJ NOPYT FIJRGZYBZ HDBMVODJI RCDXC BJO CZM DIOJ OCZ WDWGDJKCDGZ XDMXPDO. VAOZM BMVYPVODIB NCZ NKZIO NJHZ ODHZ RDOC JIZ JA OCZ GJIYJI VPXODJI CJPNZN RJMFDIB JI KMJQZIVIXZ WZAJMZ OVFDIB CZM XPMMZIO KJNDODJI RDOC OCZ GDWMVMT. OCZMZ MZVGGT DN IJOCDIB NPNKDXDJPN DI CZM WVXFBMJPIY VIY D RVN DIXGDIZY OJ RMDOZ CZM JAA VN V GZVY, WPO RCZI D BJO TJPM HZNNVBZ D YZXDYZY D RVIOZY OJ HZZO CZM. D OMDZY OJ NZO OCVO PK JIGT OJ WZ OJGY OCVO NCZ DN JPO JA XJPIOMT AJM V RCDGZ. DI XVDMJ. +D RDGG NZZ TJP OCZMZ. +CVMMT diff --git a/2017/1a.plaintext b/2017/1a.plaintext new file mode 100644 index 0000000..68a461c --- /dev/null +++ b/2017/1a.plaintext @@ -0,0 +1,4 @@ +MARYAM, +IT IS GREAT TO HEAR FROM YOU. WE DID PICK UP SOME CHATTER A COUPLE OF MONTHS AGO AND J WAS MENTIONED THERE TOO, SO WE ALREADY HAVE A FILE ON HER. HER NAME IS JODIE AND SHE WORKS AS LIAISON BETWEEN THE BRITISH LIBRARY AND THE BRITISH MUSEUM, RESEARCHING LINKS BETWEEN ARTEFACTS AND IMPERIAL ROMAN TEXTS, SO THAT TIES IN WITH THE INTELLIGENCE YOU HAVE BEEN RECEIVING. NOTHING SUGGESTS THAT SHE HAS BEEN INVOLVED IN ANYTHING SHADY AND SHE HAS HELPED WITH SEVERAL INSURANCE FRAUD CASES. SHE HAS AN INTERESTING BACKGROUND. SHE DID A PHD ON HUMAN MIGRATION STUDIES, MAINLY MATHEMATICAL MODELLING, THEN MOVED ON TO STUDY KNOWLEDGE MIGRATION WHICH GOT HER INTO THE BIBLIOPHILE CIRCUIT. AFTER GRADUATING SHE SPENT SOME TIME WITH ONE OF THE LONDON AUCTION HOUSES WORKING ON PROVENANCE BEFORE TAKING HER CURRENT POSITION WITH THE LIBRARY. THERE REALLY IS NOTHING SUSPICIOUS IN HER BACKGROUND AND I WAS INCLINED TO WRITE HER OFF AS A LEAD, BUT WHEN I GOT YOUR MESSAGE I DECIDED I WANTED TO MEET HER. I TRIED TO SET THAT UP ONLY TO BE TOLD THAT SHE IS OUT OF COUNTRY FOR A WHILE. IN CAIRO. +I WILL SEE YOU THERE. +HARRY diff --git a/2017/1b.ciphertext b/2017/1b.ciphertext new file mode 100644 index 0000000..4f588ac --- /dev/null +++ b/2017/1b.ciphertext @@ -0,0 +1 @@ +CQNBQ JVNXO VHNBC NNVNM JWMWX KUNTR WBVNW PWJND BSDUR DBJPA RLXUJ RBJBC XAHCX XXOCN WCXUM RWCQN CJENA WBXOA XVNOX ACQNN WCNAC JRWVN WCXOO XXUBJ WMLXF JAMBF QXWNE NAXWL NUNOC CQNBJ ONCHX OCQJC PANJC LRCHC QNUXB BXOCQ NRGCQ UNPRX WBBCJ WMJAM RWKJC CUNQJ DWCNM QRVCQ AXDPQ XDCQR BURON JWMXW UHQRB DWCRV NUHMN JCQKA XDPQC QRVAN URNOJ WMHNC CQNOD UUMNY CQXOQ RBBDO ONARW PRBTW XFWXW UHCXJ ONFJW MNENW RFJBW XCCJT NWRWC XQRBL XWORM NWLND WCRUJ OCNAQ RBMNJ CQCQN CADCQ XOCQN YNARU RWFQR LQQNY UJLNM CQNNW CRANA XVJWJ AVHFJ BORWJ UUHAN ENJUN MCXVN RWCQN YJYNA BQNUN OCCXV NRWQR BFRUU JVXWP CQNVR OXDWM CQRBM NBYJC LQOAX VBNGC DBEJA DBUNP JCDBX OCQNR GCQUN PRXWC XPJRD BBDNC XWRDB YJDUU RWDBY AXLXW BDUJW MPXEN AWXAX OKARC JWWRJ MNBLA RKRWP CQNMN ONJCX OCQNW RWCQJ CLJVD UXMXW DVJCC QNFAR CRWPX OCQRB VNBBJ PNCQN RLNWR QJENB DLLNB BODUU HBJLT NMCQN LRCHR WLUDM RWPCQ NCNVY UNXOL UJDMR DBFQN ANCQN YAXLD AJCXA BPDJA MCXXT CQNRA QNAXR LORWJ UBCJW MFNFN ANJUV XBCNW LRALU NMKHC QNNWN VHOXA LNFQX BNNVN MYXBB NBBNM XOCQN YXFNA CXTWX FXDAC QXDPQ CBFQN ANFNF NANBC AXWPC QNHYX BCNMX WUHQX UMRWP OXALN BFQNA NFNFN ANFNJ TCQNH JCCJL TNMRW BCANW PCQJW MFQNW ANRWO XALNV NWCBJ CCNVY CNMCX SXRWD BCQNH FNANJ CCJLT NMXWA XDCNF NBDAE REXAB XFNXD AUREN BJWMX DACQJ WTBCX PWJND BSDUR DBJPA RLXUJ FQXRW JCRVN XOPAN JCNVN APNWL HANLX PWRBN MCQNB CAJCN PHXOC QNRWB DAPNW COXAL NBXWX DAUNO COUJW TJWML XVVJW MNMXD AANCA NJCFR CQVXV NWCBC XBYJA NMDNC XCQRB JLCRX WCQNV JSXAR CHXOX DALJE JUAHF NANBJ ENMJU XWPFR CQCQN ANBNA ENOXA LNBJU UXCQN AOAXW CURWN CAXXY BQJEN KNNWB UJDPQ CNANM JWMRC RBFRC QPANJ CBJMW NBBJW MMNNY NBCJW PNARQ JENCX ANYXA CCQJC CQNRG CQUNP RXWUX BCRCB JZDRU JCXCQ NNWNV HRONJ ACQJC ROFNJ ANCXB JENUX WMRWR DVJWM ENADU JWRDV OAXVJ BRVRU JAOJC NFNVD BCORW MCQNB CANWP CQCXL ADBQC QRBAN KNUUR XWROF NOJRU CQNWJ UUXOK ARCJW WRJRB UXBCC QRBVD LQXOJ PARLX UJBBC XAHRB FRMNU HTWXF WKDCC QNODU UCADC QVDBC ANVJR WQRMM NWOXA WXFJW MJBAN VJATN MKHVH CADBC NMBUJ ENJWM LXWOR MJWCC RAXFQ JCKNC CNAYU JLNCX QRMNJ KXXTC QJWJV XWPKX XTB \ No newline at end of file diff --git a/2017/1b.plaintext b/2017/1b.plaintext new file mode 100644 index 0000000..e90d092 --- /dev/null +++ b/2017/1b.plaintext @@ -0,0 +1 @@ +the shame of my esteemed and noble kinsmen gnaeus julius agricola is a story too often told in the taverns of rome for the entertainment of fools and cowards who never once left the safety of that great city the loss of the ixth legions standard in battle haunted him throughout his life and only his untimely death brought him relief and yet the full depth of his suffering is known only to a few and even i was not taken into his confidence until after his death the truth of the peril in which he placed the entire roman army was finally revealed to me in the paper she left to me in his will among them i found this despatch from sextus varus legatus of the ixth legion to gaius suetonius paul linus proconsul and governor of britannia describing the defeat of then in that camu lo donum at the writing of this message the iceni have successfully sacked the city including the temple of claudius where the procurators guard took their heroic final stand we were almost encircled by the enemy force who seemed possessed of the power to know our thoughts where we were strong they posted only holding forces where we were weak they attacked in strength and when reinforcements attempted to join us they were attacked on route we survivors owe our lives and our thanks to gnaeus julius agricola who in a time of great emergency recognised the strategy of the insurgent forces on our left flank and commanded our retreat with moments to spare due to this action the majority of our cavalry were saved along with the reserve forces all other frontline troops have been slaughtered and it is with great sadness and deepest anger i have to report that the ixth legion lost its aquila to the enemy i fear that if we are to save londinium and ver ulan ium from a similar fate we must find the strength to crush this rebellion if we fail then all of britannia is lost this much of agricola s story is widely known but the full truth must remain hidden for now and as remarked by my trusted slave and confidant tiro what better place to hide a book than among books \ No newline at end of file diff --git a/2017/2017-challenge1.ipynb b/2017/2017-challenge1.ipynb new file mode 100644 index 0000000..67c1188 --- /dev/null +++ b/2017/2017-challenge1.ipynb @@ -0,0 +1,175 @@ +{ + "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) \n", + "\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline\n", + "\n", + "from cipherbreak import *\n", + "\n", + "c1a = open('1a.ciphertext').read()\n", + "c1b = open('1b.ciphertext').read()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(21, -1118.7370341550713)" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key_a, score = caesar_break(c1a)\n", + "key_a, score" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "MARYAM,\n", + "IT IS GREAT TO HEAR FROM YOU. WE DID PICK UP SOME CHATTER A COUPLE OF MONTHS AGO AND J WAS MENTIONED THERE TOO, SO WE ALREADY HAVE A FILE ON HER. HER NAME IS JODIE AND SHE WORKS AS LIAISON BETWEEN THE BRITISH LIBRARY AND THE BRITISH MUSEUM, RESEARCHING LINKS BETWEEN ARTEFACTS AND IMPERIAL ROMAN TEXTS, SO THAT TIES IN WITH THE INTELLIGENCE YOU HAVE BEEN RECEIVING. NOTHING SUGGESTS THAT SHE HAS BEEN INVOLVED IN ANYTHING SHADY AND SHE HAS HELPED WITH SEVERAL INSURANCE FRAUD CASES. SHE HAS AN INTERESTING BACKGROUND. SHE DID A PHD ON HUMAN MIGRATION STUDIES, MAINLY MATHEMATICAL MODELLING, THEN MOVED ON TO STUDY KNOWLEDGE MIGRATION WHICH GOT HER INTO THE BIBLIOPHILE CIRCUIT. AFTER GRADUATING SHE SPENT SOME TIME WITH ONE OF THE LONDON AUCTION HOUSES WORKING ON PROVENANCE BEFORE TAKING HER CURRENT POSITION WITH THE LIBRARY. THERE REALLY IS NOTHING SUSPICIOUS IN HER BACKGROUND AND I WAS INCLINED TO WRITE HER OFF AS A LEAD, BUT WHEN I GOT YOUR MESSAGE I DECIDED I WANTED TO MEET HER. I TRIED TO SET THAT UP ONLY TO BE TOLD THAT SHE IS OUT OF COUNTRY FOR A WHILE. IN CAIRO.\n", + "I WILL SEE YOU THERE.\n", + "HARRY\n", + "\n" + ] + } + ], + "source": [ + "print(caesar_decipher(c1a, key_a))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1113" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open('1a.plaintext', 'w').write(caesar_decipher(c1a, key_a))" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(9, -2106.6033294392596)" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "key_b, score = caesar_break(c1b)\n", + "key_b, score" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'the shame of my esteemed and noble kinsmen gnaeus julius agricola is a story too often told in the taverns of rome for the entertainment of fools and cowards who never once left the safety of that great city the loss of the ixth legions standard in battle haunted him throughout his life and only his untimely death brought him relief and yet the full depth of his suffering is known only to a few and even i was not taken into his confidence until after his death the truth of the peril in which he placed the entire roman army was finally revealed to me in the paper she left to me in his will among them i found this despatch from sextus varus legatus of the ixth legion to gaius suetonius paul linus proconsul and governor of britannia describing the defeat of then in that camu lo donum at the writing of this message the iceni have successfully sacked the city including the temple of claudius where the procurators guard took their heroic final stand we were almost encircled by the enemy force who seemed possessed of the power to know our thoughts where we were strong they posted only holding forces where we were weak they attacked in strength and when reinforcements attempted to join us they were attacked on route we survivors owe our lives and our thanks to gnaeus julius agricola who in a time of great emergency recognised the strategy of the insurgent forces on our left flank and commanded our retreat with moments to spare due to this action the majority of our cavalry were saved along with the reserve forces all other frontline troops have been slaughtered and it is with great sadness and deepest anger i have to report that the ixth legion lost its aquila to the enemy i fear that if we are to save londinium and ver ulan ium from a similar fate we must find the strength to crush this rebellion if we fail then all of britannia is lost this much of agricola s story is widely known but the full truth must remain hidden for now and as remarked by my trusted slave and confidant tiro what better place to hide a book than among books'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wcat(segment(sanitise(caesar_decipher(c1b, key_b))))" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2058" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open('1b.plaintext', 'w').write(wcat(segment(sanitise(caesar_decipher(c1b, key_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.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}