{ "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": 16, "metadata": {}, "outputs": [], "source": [ "from cipher.caesar import *\n", "from cipher.affine import *\n", "from cipher.keyword_cipher import *\n", "from cipher.column_transposition import *\n", "from cipher.vigenere import *\n", "from support.text_prettify import *\n", "from support.utilities import *\n", "from support.plot_frequency_histogram import *" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "challenge_number = 4\n", "plaintext_a_filename = f'{challenge_number}a.plaintext'\n", "plaintext_b_filename = f'{challenge_number}b.plaintext'\n", "ciphertext_a_filename = f'{challenge_number}a.ciphertext'\n", "ciphertext_b_filename = f'{challenge_number}b.ciphertext'" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "ca = open(ciphertext_a_filename).read()\n", "cb = open(ciphertext_b_filename).read()\n", "sca = sanitise(ca)\n", "pca = letters(ca)\n", "pta = depunctuate(ca)\n", "\n", "scb = sanitise(cb)\n", "pcb = letters(cb)\n", "ptb = depunctuate(cb)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "15 21 True \n", "\n", "WES, N GOHE ZEED VKFBNDS TGFKASG TGE INMT KL MAMRNCNKAM NDCNPEDTM OLLECTNDS ORKIIK EIEHED ODP NT NM\n", "IKDSEF TGOD QKA WNSGT TGNDB. TGE RFE-IOADCG, MTOSE TGFEE TGFAMTEF HOIHE RFKZIEW NM O INTTIE\n", "MAMRNCNKAM SNHED OII TGE CGECBM TGOT TKKB RIOCE ZELKFE TGOT, ZAT KD TGE KTGEF GODP TEIEWETFQ\n", "SAOFODTEEP TGOT NT VKAIP ZE PETECTEP ODP TGE TECGDNCNODM MGKVEP TGOT NT VOM EOMQ TK ZQROMM. NL TGOT\n", "VOM O MOZKTOSE OTTEWRT TGED NT VOMD'T HEFQ VEII PEMNSDEP, MK N PKD'T TGNDB NT CKAIP GOHE ZEED OD\n", "EDSNDEEF TGOT MET NT AR. KD TGE KTGEF GODP, DK-KDE EIME VKAIP GOHE GOP TNWE OIKDE VNTG TGE\n", "CKWRKDEDT. KD TGE KTGEF GODP, MKWEKDE LFKW LNPK'M TEOW MEDT WE O WEMMOSE TK TEII WE OZKAT O HEFQ\n", "DEOF WNMM TGOT MKADPM INBE NT CKAIP GOHE ZEED O MEFNKAM OTTEWRT TK PEMTFKQ TGE CKWWODP WKPAIE KD\n", "FE-EDTFQ. OM ORKIIK JN ORRFKOCGEP TGE FE-EDTFQ RKNDT TGEQ UETTNMKDEP TGE MEFHNCE WKPAIE TK FE-KFNEDT\n", "TGE CKWWODP WKPAIE MK TGOT TGE GEOTMGNEIP VOM RKNDTNDS NDTK TGE OTWKMRGEFE. MNDCE TGEQ VEFE KD\n", "RFETTQ WACG O ZOIINMTNC KFZNT TGE MW VKAIP GOHE MTOQEP CIKME TK TGE CW, ODP VNTGKAT O GEOTMGNEIP KL\n", "NTM KVD NT VKAIP ZFEOB AR NDTK IOFSE RNECEM TGOT RKMEP O MNSDNLNCODT PODSEF TK TGE CW ODP NTM CFEV.\n", "TK OHKNP TGOT TGE MW VOM MARRKMEP TK COFFQ KAT O MEYAEDCE KL MGKFT ZAFDM TK WKHE NTM TFOUECTKFQ OVOQ\n", "LFKW TGE CKWWODP WKPAIE, MBNRRNDS NT KLL TGE OTWKMRGEFE MK TGOT TGE CW CKAIP FE-EDTEF LFEE LFKW TGE\n", "PEZFNM LNEIP. ADLKFTADOTEIQ, TGOT PKEMD'T MEEW TK GOHE GORREDEP. OIPFND FERKFTEP TGOT TGE CW LIEV\n", "ROMT TGE MW VGNCG VOM LIQNDS OT OD OTTOCB ODSIE VEII ZEQKDP KREFOTNKDOI ROFOWETEFM, ODP O CKWWEFCNOI\n", "RNIKT, LFODB ZFKVD, FERKFTEP MEENDS TGE TVK MROCECFOLT TFOCBNDS CIKMEIQ OM TGEQ ZAFDEP TGFKASG TGE\n", "OTWKMRGEFE. O MNDSIE CKIINMNKD VNTG KDE KL TGE VGNTE-GKT LFOSWEDTM CKAIP GOHE ZOPIQ POWOSEP TGE\n", "FE-EDTFQ CORMAIE, ODP EHED NL TGE OMTFKDOATM GOP MAFHNHEP TGE CKIINMNKD TGED TGE KPPM OFE TGOT TGE\n", "ROFOCGATE MQMTEW VKAIP GOHE TFNSSEFEP EOFIQ KF ZEED LOTOIIQ POWOSEP ZQ TGE ZIOMT. DOMO EDSNDEEFM OFE\n", "VKFBNDS LOMT TK CKFFECT TGE RFKZIEW LKF ORKIIK JNNN ODP TGEQ GOHE WNTNSOTNKDM ND RIOCE LKF JNN'M\n", "FE-EDTFQ, ZAT TGE HNEV KL TGE EJREFTM NM TGOT TGEQ PKPSEP O ZAIIET VNTG TGNM. TGE LINSGT KLLNCEF VGK\n", "FERKFTEP NT TK WE RKNDTEP KAT TGOT NL TGE MKHNETM VODTEP TK MOZKTOSE TGE WNMMNKD TGNM WNSGT GOHE\n", "ZEED O SKKP ZET: NT VOM O DOMTQ OCCNPEDT TGOT VOM GOFP TK LKFEMEE, ODP NT VNII ZE HEFQ PNLLNCAIT TK\n", "MGKV TGOT MKWEKDE PEINZEFOTEIQ WNMCOICAIOTEP TGE ZAFD TNWEM MNDCE NT VOM TGE NDTEFOCTNKD KL TGE\n", "TGFAMTEFM ODP MTOZNINMEFM TGOT COAMEP TGE RFKZIEW. N TGNDB GE NM KDE KL O SFKVNDS DAWZEF KL DOMO\n", "EWRIKQEEM VGK GOHE ZESAD TK ZEINEHE TGOT TGE AMMF GOM PEER CKHEF OSEDTM VKFBNDS TK PEMTOZNINME TGE\n", "RFKSFOWWE. WQ VKFFQ NM TGOT EHED NL GE NM VFKDS, TGE IOCB KL TFAMT TGOT NM SFKVNDS VNTGND TGE\n", "KFSODNMOTNKD VNII PEMTOZNINME NT KD NTM KVD. N OW FEOIIQ GKRNDS GE NM WNMTOBED. TGE MACCEMM KL\n", "ORKIIK JN MEEWM TK GOHE ZKASGT O IKT KL NDTEFDOTNKDOI SKKPVNII ODP N TGNDB NT CKAIP ZE TGE MTOFT KL\n", "MKWETGNDS WKFE RKMNTNHE. TGE MKHNET CKKREFOTNKD VNTG TGE IODPNDS SOHE WE GKRE TGOT VE CKAIP LNDP\n", "WKFE CKWWKD SFKADP ODP MTOFT TK TGOV EOMT-VEMT FEIOTNKDM, ZAT TGNM CKAIP FEOIIQ TGFEOTED TGOT. ND\n", "TGE WEOD-TNWE VE GOP ZETTEF MTER AR MECAFNTQ. N TGNDB VE MGKAIP AME O MNWRIE HNSEDEFE CNRGEF VNTG\n", "REFNKP TVK LKF KAF DEJT WEMMOSE. N GOHE EDCFQRTEP TGE OTTOCGEP FE-EDTFQ FERKFT AMNDS O CKIAWDOF\n", "TFODMRKMNTNKD CNRGEF\n" ] } ], "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())))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('lunar', , -3366.553587533618)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(key_a, wrap_a), score_a = keyword_break_mp(ca)\n", "key_a, wrap_a, score_a" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "meg, i have been working through the list of suspicious incidents affecting apollo eleven and it is\n", "longer than you might think. the pre-launch, stage three thruster valve problem is a little\n", "suspicious given all the checks that took place before that, but on the other hand telemetry\n", "guaranteed that it would be detected and the technicians showed that it was easy to bypass. if that\n", "was a sabotage attempt then it wasn't very well designed, so i don't think it could have been an\n", "engineer that set it up. on the other hand, no-one else would have had time alone with the\n", "component. on the other hand, someone from fido's team sent me a message to tell me about a very\n", "near miss that sounds like it could have been a serious attempt to destroy the command module on\n", "re-entry. as apollo xi approached the re-entry point they jettisoned the service module to re-orient\n", "the command module so that the heatshield was pointing into the atmosphere. since they were on\n", "pretty much a ballistic orbit the sm would have stayed close to the cm, and without a heatshield of\n", "its own it would break up into large pieces that posed a significant danger to the cm and its crew.\n", "to avoid that the sm was supposed to carry out a sequence of short burns to move its trajectory away\n", "from the command module, skipping it off the atmosphere so that the cm could re-enter free from the\n", "debris field. unfortunately, that doesn't seem to have happened. aldrin reported that the cm flew\n", "past the sm which was flying at an attack angle well beyond operational parameters, and a commercial\n", "pilot, frank brown, reported seeing the two spacecraft tracking closely as they burned through the\n", "atmosphere. a single collision with one of the white-hot fragments could have badly damaged the\n", "re-entry capsule, and even if the astronauts had survived the collision then the odds are that the\n", "parachute system would have triggered early or been fatally damaged by the blast. nasa engineers are\n", "working fast to correct the problem for apollo xiii and they have mitigations in place for xii's\n", "re-entry, but the view of the experts is that they dodged a bullet with this. the flight officer who\n", "reported it to me pointed out that if the soviets wanted to sabotage the mission this might have\n", "been a good bet: it was a nasty accident that was hard to foresee, and it will be very difficult to\n", "show that someone deliberately miscalculated the burn times since it was the interaction of the\n", "thrusters and stabilisers that caused the problem. i think he is one of a growing number of nasa\n", "employees who have begun to believe that the ussr has deep cover agents working to destabilise the\n", "programme. my worry is that even if he is wrong, the lack of trust that is growing within the\n", "organisation will destabilise it on its own. i am really hoping he is mistaken. the success of\n", "apollo xi seems to have bought a lot of international goodwill and i think it could be the start of\n", "something more positive. the soviet cooperation with the landing gave me hope that we could find\n", "more common ground and start to thaw east-west relations, but this could really threaten that. in\n", "the mean-time we had better step up security. i think we should use a simple vigenere cipher with\n", "period two for our next message. i have encrypted the attached re-entry report using a columnar\n", "transposition cipher\n" ] } ], "source": [ "print(lcat(tpack(keyword_decipher(ca, key_a, wrap_a).split())))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MEG,\n", "I HAVE BEEN WORKING THROUGH THE LIST OF SUSPICIOUS INCIDENTS AFFECTING APOLLO ELEVEN AND IT IS LONGER THAN YOU MIGHT THINK. THE PRE-LAUNCH, STAGE THREE THRUSTER VALVE PROBLEM IS A LITTLE SUSPICIOUS GIVEN ALL THE CHECKS THAT TOOK PLACE BEFORE THAT, BUT ON THE OTHER HAND TELEMETRY GUARANTEED THAT IT WOULD BE DETECTED AND THE TECHNICIANS SHOWED THAT IT WAS EASY TO BYPASS. IF THAT WAS A SABOTAGE ATTEMPT THEN IT WASN'T VERY WELL DESIGNED, SO I DON'T THINK IT COULD HAVE BEEN AN ENGINEER THAT SET IT UP. ON THE OTHER HAND, NO-ONE ELSE WOULD HAVE HAD TIME ALONE WITH THE COMPONENT. ON THE OTHER HAND, SOMEONE FROM FIDO'S TEAM SENT ME A MESSAGE TO TELL ME ABOUT A VERY NEAR MISS THAT SOUNDS LIKE IT COULD HAVE BEEN A SERIOUS ATTEMPT TO DESTROY THE COMMAND MODULE ON RE-ENTRY.\n", "AS APOLLO XI APPROACHED THE RE-ENTRY POINT THEY JETTISONED THE SERVICE MODULE TO RE-ORIENT THE COMMAND MODULE SO THAT THE HEATSHIELD WAS POINTING INTO THE ATMOSPHERE. SINCE THEY WERE ON PRETTY MUCH A BALLISTIC ORBIT THE SM WOULD HAVE STAYED CLOSE TO THE CM, AND WITHOUT A HEATSHIELD OF ITS OWN IT WOULD BREAK UP INTO LARGE PIECES THAT POSED A SIGNIFICANT DANGER TO THE CM AND ITS CREW. TO AVOID THAT THE SM WAS SUPPOSED TO CARRY OUT A SEQUENCE OF SHORT BURNS TO MOVE ITS TRAJECTORY AWAY FROM THE COMMAND MODULE, SKIPPING IT OFF THE ATMOSPHERE SO THAT THE CM COULD RE-ENTER FREE FROM THE DEBRIS FIELD. UNFORTUNATELY, THAT DOESN'T SEEM TO HAVE HAPPENED. ALDRIN REPORTED THAT THE CM FLEW PAST THE SM WHICH WAS FLYING AT AN ATTACK ANGLE WELL BEYOND OPERATIONAL PARAMETERS, AND A COMMERCIAL PILOT, FRANK BROWN, REPORTED SEEING THE TWO SPACECRAFT TRACKING CLOSELY AS THEY BURNED THROUGH THE ATMOSPHERE. A SINGLE COLLISION WITH ONE OF THE WHITE-HOT FRAGMENTS COULD HAVE BADLY DAMAGED THE RE-ENTRY CAPSULE, AND EVEN IF THE ASTRONAUTS HAD SURVIVED THE COLLISION THEN THE ODDS ARE THAT THE PARACHUTE SYSTEM WOULD HAVE TRIGGERED EARLY OR BEEN FATALLY DAMAGED BY THE BLAST. NASA ENGINEERS ARE WORKING FAST TO CORRECT THE PROBLEM FOR APOLLO XIII AND THEY HAVE MITIGATIONS IN PLACE FOR XII'S RE-ENTRY, BUT THE VIEW OF THE EXPERTS IS THAT THEY DODGED A BULLET WITH THIS. THE FLIGHT OFFICER WHO REPORTED IT TO ME POINTED OUT THAT IF THE SOVIETS WANTED TO SABOTAGE THE MISSION THIS MIGHT HAVE BEEN A GOOD BET: IT WAS A NASTY ACCIDENT THAT WAS HARD TO FORESEE, AND IT WILL BE VERY DIFFICULT TO SHOW THAT SOMEONE DELIBERATELY MISCALCULATED THE BURN TIMES SINCE IT WAS THE INTERACTION OF THE THRUSTERS AND STABILISERS THAT CAUSED THE PROBLEM. I THINK HE IS ONE OF A GROWING NUMBER OF NASA EMPLOYEES WHO HAVE BEGUN TO BELIEVE THAT THE USSR HAS DEEP COVER AGENTS WORKING TO DESTABILISE THE PROGRAMME. MY WORRY IS THAT EVEN IF HE IS WRONG, THE LACK OF TRUST THAT IS GROWING WITHIN THE ORGANISATION WILL DESTABILISE IT ON ITS OWN. I AM REALLY HOPING HE IS MISTAKEN. THE SUCCESS OF APOLLO XI SEEMS TO HAVE BOUGHT A LOT OF INTERNATIONAL GOODWILL AND I THINK IT COULD BE THE START OF SOMETHING MORE POSITIVE. THE SOVIET COOPERATION WITH THE LANDING GAVE ME HOPE THAT WE COULD FIND MORE COMMON GROUND AND START TO THAW EAST-WEST RELATIONS, BUT THIS COULD REALLY THREATEN THAT.\n", "IN THE MEAN-TIME WE HAD BETTER STEP UP SECURITY. I THINK WE SHOULD USE A SIMPLE VIGENERE CIPHER WITH PERIOD TWO FOR OUR NEXT MESSAGE. I HAVE ENCRYPTED THE ATTACHED RE-ENTRY REPORT USING A COLUMNAR TRANSPOSITION CIPHER\n", "\n" ] }, { "data": { "text/plain": [ "3344" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(repunctuate(keyword_decipher(ca, key_a, wrap_a), pta))\n", "open(plaintext_a_filename, 'w').write(repunctuate(keyword_decipher(ca, key_a, wrap_a), pta))" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(((2, 4, 3, 1, 0, 6, 5), False, True), -7729.531557000563)" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(key_b, fillcolumnwise_b, emptycolumnwise_b), score_b = column_transposition_break_mp(scb, fitness=Ptrigrams)\n", "(key_b, fillcolumnwise_b, emptycolumnwise_b), score_b" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(((6, 5, 4, 3, 2, 1, 0), False, False), -8768.791674998944)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# (key_b, fillcolumnwise_b, emptycolumnwise_b), score_b = column_transposition_break_mp(scb, fitness=Pbigrams)\n", "# (key_b, fillcolumnwise_b, emptycolumnwise_b), score_b" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'apolloxipostflightanalysisspacecraftreentrytrajectoryreviewthisdocumentcontainsinformationabouttheeventsduringthereentryphaseofapolloxiithasbeencompiledtosatisfyflightplanningsafetyrequirementsthereviewcoversthefollowingmissionphasetransearthcoastwhichendswithreentryintothemidpacificrecoveryareatheoriginalflightplancalledforseparationofthecmfromthesmtwelveminutesbeforeentryinterfacesuccessfulseparationwouldthentriggerasequenceofburnsintendedtostabilisetheservicemoduleandtomoveitoutofthereentrycorridortoavoiddebriscollisionswiththecommandmoduleduringthereentryphasethereactioncontrolsystemburnsequenceinvolvedboththerollandtheminusxjetstheattitudeburnswereintendedtosetuparollinordertostabiliseremainingfuelandtopreventuncontrolledgyrationduringtheboostthatwouldhavethentakenthesmoutofthereentrycorridorintoahighaltitudeorbitthatwoulddecayonlyafterthecommandmodulehadlandedintheeventthesequenceofburnsdidnotachievetherequiredtrajectoryshiftwithreportsfromtheastronautsonboardandfromacommercialairlinepilotthatthetwospacevehiclesreenteredtheatmospheretogetherwiththecmpassingthesmduringtheplasmaburnphasegiventheproximityofthevehiclesduringreentryitisconsideredhighlyfortunatethatnodebrisfromtherelativelyunprotectedsmstruckthecmandsimulationsshowthatsuchastrikewouldhavebeenlikelytocausecatastrophicdamagetothecmpossibledefectsarisingfromacollisionincludeiheatshielddamageevenaminorcrackinoneoftheheatshieldpanelswouldbelikelytocausesuperheatingwhichcouldbreachthehullleadingtofurthercatastrophicdamagetothevehiclewithprobablelossoflifeiiprematurefiringoftheparachutepyrotechnicsleadingtofullorpartiallossofthedescentarrestsystemandlossoflifeiiidamagetotheparachuteshieldmighthavepreventedthepyrotechnicsfromreleasingtheparachutesleadingtoacatastrophiccollisiononlandingandlossoflifeivdamagetooneormoreoftheparachutescouldhaveledtoahighvelocityimpactwithprobableresultinginjuriesandpossiblelossoflifethehighlikelihoodofcatastrophicfailurearisingfromthedeviationfromflightparametersmeansthatfurtheranalysisoftheseparationburnstrategyisrequiredpendingthatremediationfortheapolloxiireentrytrajectoryisahighpriorityitissuggestedthatsurplusfuelshouldbeejectedfromthesmbeforetheseparationburnbeginsinordertostabilisetheattitudeandthattheminusxburnsshouldbetimedtocoincidewiththerolljetstoimprovestability'" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "column_transposition_decipher(scb, key_b, fillcolumnwise=fillcolumnwise_b, emptycolumnwise=emptycolumnwise_b)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "apollo xi post flight analysis spacecraft reentry trajectory review this document contains\n", "information about the events during there entry phase of apollo xiith as been compiled to satisfy\n", "flight planning safety requirements the review covers the following mission phase trans earth coast\n", "which ends with reentry into the mid pacific recovery area the original flightplan called for\n", "separation of the cm from the sm twelve minutes before entry interface successful separation would\n", "then trigger a sequence of burns intended to stabilise the service module and to move it out of\n", "there entry corridor to avoid debris collisions with the command module during there entry phase the\n", "reaction control system burn sequence involved both the roll and the minus x jets the attitude burns\n", "were intended to setup a rollin order to stabilise remaining fuel and to prevent uncontrolled\n", "gyration during the boost that would have then taken the sm out of there entry corridor into a high\n", "altitude orbit that would decay only after the command module had landed in the event the sequence\n", "of burns did not achieve the required trajectory shift with reports from the astronauts onboard and\n", "from a commercial airline pilot that the two space vehicles reentered the atmosphere together with\n", "the cm passing the sm during the plasma burn phase given the proximity of the vehicles during\n", "reentry it is considered highly fortunate that no debris from the relatively unprotected sms truck\n", "the cm and simulations show that such a strike would have been likely to cause catastrophic damage\n", "to the cm possible defects arising from a collision include i heatshield damage even a minor crack\n", "in one of the heatshield panels would be likely to cause super heating which could breach the hull\n", "leading to further catastrophic damage to the vehicle with probable loss of life ii premature firing\n", "of the parachute pyrotechnics leading to full or partial loss of the descent arrest system and loss\n", "of life iii damage to the parachute shield might have prevented the pyrotechnics from releasing the\n", "parachutes leading to a catastrophic collision on landing and loss of life iv damage to one or more\n", "of the parachutes could have led to a high velocity impact with probable resulting injuries and\n", "possible loss of life the high likelihood of catastrophic failure arising from the deviation from\n", "flight parameters means that further analysis of the separation burn strategy is required pending\n", "that remediation for the apollo xii reentry trajectory is a high priority it is suggested that\n", "surplus fuel should be ejected from the sm before the separation burn begins in order to stabilise\n", "the attitude and that the minus x burns should be timed to coincide with the roll jets to improve\n", "stability\n" ] } ], "source": [ "print(lcat(tpack(segment(column_transposition_decipher(scb, key_b, fillcolumnwise=fillcolumnwise_b, emptycolumnwise=emptycolumnwise_b)))))" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2756" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "open(plaintext_b_filename, 'w').write(lcat(tpack(segment(column_transposition_decipher(scb, key_b, fillcolumnwise=fillcolumnwise_b, emptycolumnwise=emptycolumnwise_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 }