Updated for challenge 9
[cipher-tools.git] / LJ!-Qt!-Fghxft-dferts;-hsjeukaxxn-sfedw.ipynb
1 {
2 "metadata": {
3 "name": "",
4 "signature": "sha256:256d7cbeceb110bdd970d796e22b0b9a746259f81a6da52f94b471762908873e"
5 },
6 "nbformat": 3,
7 "nbformat_minor": 0,
8 "worksheets": [
9 {
10 "cells": [
11 {
12 "cell_type": "code",
13 "collapsed": false,
14 "input": [
15 "from cipherbreak import *"
16 ],
17 "language": "python",
18 "metadata": {},
19 "outputs": [],
20 "prompt_number": 5
21 },
22 {
23 "cell_type": "code",
24 "collapsed": false,
25 "input": [
26 "ct = \"LJ! Qt! Fghxft dferts; hsjeukaxxn sfedw.\""
27 ],
28 "language": "python",
29 "metadata": {},
30 "outputs": [],
31 "prompt_number": 1
32 },
33 {
34 "cell_type": "code",
35 "collapsed": false,
36 "input": [
37 "ctu = ct.upper()\n",
38 "ctu"
39 ],
40 "language": "python",
41 "metadata": {},
42 "outputs": [
43 {
44 "metadata": {},
45 "output_type": "pyout",
46 "prompt_number": 10,
47 "text": [
48 "'LJ! QT! FGHXFT DFERTS; HSJEUKAXXN SFEDW.'"
49 ]
50 }
51 ],
52 "prompt_number": 10
53 },
54 {
55 "cell_type": "code",
56 "collapsed": false,
57 "input": [
58 "ctu4 = ctu.split()[4]\n",
59 "ctu2 = ctu.split()[2]\n",
60 "ctu3 = ctu.split()[3]"
61 ],
62 "language": "python",
63 "metadata": {},
64 "outputs": [],
65 "prompt_number": 27
66 },
67 {
68 "cell_type": "code",
69 "collapsed": false,
70 "input": [
71 "seeds4 = [w for w in keywords if len(w) == 10 and w[-2] == w[-3] and len(set(w)) == 9]\n",
72 "len(seeds4)"
73 ],
74 "language": "python",
75 "metadata": {},
76 "outputs": [
77 {
78 "metadata": {},
79 "output_type": "pyout",
80 "prompt_number": 14,
81 "text": [
82 "50"
83 ]
84 }
85 ],
86 "prompt_number": 14
87 },
88 {
89 "cell_type": "code",
90 "collapsed": false,
91 "input": [
92 "seeds2 = [w for w in keywords if len(w) == 6 and w[0] == w[-2] and len(set(w)) == 5]\n",
93 "len(seeds2)"
94 ],
95 "language": "python",
96 "metadata": {},
97 "outputs": [
98 {
99 "metadata": {},
100 "output_type": "pyout",
101 "prompt_number": 17,
102 "text": [
103 "283"
104 ]
105 }
106 ],
107 "prompt_number": 17
108 },
109 {
110 "cell_type": "code",
111 "collapsed": false,
112 "input": [
113 "seeds3 = [w for w in keywords if len(w) == 6 and len(set(w)) == 6]\n",
114 "len(seeds3)"
115 ],
116 "language": "python",
117 "metadata": {},
118 "outputs": [
119 {
120 "metadata": {},
121 "output_type": "pyout",
122 "prompt_number": 26,
123 "text": [
124 "5252"
125 ]
126 }
127 ],
128 "prompt_number": 26
129 },
130 {
131 "cell_type": "code",
132 "collapsed": false,
133 "input": [
134 "for s in seeds4:\n",
135 " print(ctu.translate(''.maketrans({f: t for f, t in zip(ctu4, s)})))"
136 ],
137 "language": "python",
138 "metadata": {},
139 "outputs": [
140 {
141 "output_type": "stream",
142 "stream": "stdout",
143 "text": [
144 "Lc! QT! FGaeFT DFtRTu; auctioneer uFtDW.\n",
145 "La! QT! FGblFT DFsRTo; boastfully oFsDW.\n",
146 "Le! QT! FGclFT DFrRTa; caerphilly aFrDW.\n",
147 "Lt! QT! FGcoFT DFhRTa; catherwood aFhDW.\n",
148 "Li! QT! FGcoFT DFlRTh; childproof hFlDW.\n",
149 "Lt! QT! FGclFT DFrRTi; citronella iFrDW.\n",
150 "Lo! QT! FGelFT DFtRTr; erotically rFtDW.\n",
151 "Lh! QT! FGelFT DFnRTt; ethnically tFnDW.\n",
152 "Lo! QT! FGelFT DFtRTx; exotically xFtDW.\n",
153 "Lr! QT! FGgeFT DFnRTa; garnisheed aFnDW.\n",
154 "La! QT! FGglFT DFcRTr; gracefully rFcDW.\n",
155 "La! QT! FGglFT DFtRTr; gratefully rFtDW.\n",
156 "Lr! QT! FGhlFT DFoRTe; heroically eFoDW.\n",
157 "Ln! QT! FGhlFT DFtRTu; huntsville uFtDW.\n",
158 "Lf! QT! FGilFT DFoRTn; informally nFoDW.\n",
159 "Lg! QT! FGloFT DFhRTi; lightproof iFhDW.\n",
160 "Lg! QT! FGlrFT DFaRTo; loganberry oFaDW.\n",
161 "Lr! QT! FGmlFT DFcRTe; mercifully eFcDW.\n",
162 "Lt! QT! FGmlFT DFrRTe; metrically eFrDW.\n",
163 "Ll! QT! FGmeFT DFwRTi; milwaukees iFwDW.\n",
164 "Lr! QT! FGmlFT DFtRTi; mirthfully iFtDW.\n",
165 "Lg! QT! FGnlFT DFhRTi; nightfalls iFhDW.\n",
166 "Lr! QT! FGpoFT DFeRTa; parenthood aFeDW.\n",
167 "Lr! QT! FGplFT DFsRTe; personally eFsDW.\n",
168 "Lo! QT! FGplFT DFnRTh; phonically hFnDW.\n",
169 "Lr! QT! FGplFT DFaRTi; pirandello iFaDW.\n",
170 "Le! QT! FGplFT DFtRTo; poetically oFtDW.\n",
171 "Lw! QT! FGplFT DFeRTo; powerfully oFeDW.\n",
172 "Li! QT! FGpoFT DFeRTr; priesthood rFeDW.\n",
173 "Lo! QT! FGplFT DFdRTr; prodigally rFdDW.\n",
174 "Lg! QT! FGrlFT DFiRTe; regionally eFiDW.\n",
175 "Lg! QT! FGrlFT DFhRTi; rightfully iFhDW.\n",
176 "Ls! QT! FGrlFT DFtRTu; rustically uFtDW.\n",
177 "Lo! QT! FGslFT DFrRTc; scornfully cFrDW.\n",
178 "La! QT! FGslFT DFmRTh; shamefully hFmDW.\n",
179 "Li! QT! FGslFT DFtRTp; spitefully pFtDW.\n",
180 "Lu! QT! FGsoFT DFiRTq; squirehood qFiDW.\n",
181 "Lr! QT! FGslFT DFgRTu; surgically uFgDW.\n",
182 "Lb! QT! FGtoFT DFlRTa; tablespoon aFlDW.\n",
183 "Lm! QT! FGtlFT DFpRTe; temporally eFpDW.\n",
184 "Lr! QT! FGtlFT DFmRTe; terminally eFmDW.\n",
185 "La! QT! FGtlFT DFnRTh; thankfully hFnDW.\n",
186 "La! QT! FGtlFT DFnRTr; tranquilly rFnDW.\n",
187 "Le! QT! FGtlFT DFaRTr; treadmills rFaDW.\n",
188 "Ld! QT! FGuoFT DFeRTn; undershoot nFeDW.\n",
189 "Lr! QT! FGvlFT DFtRTe; vertically eFtDW.\n",
190 "Ls! QT! FGwlFT DFtRTa; wastefully aFtDW.\n",
191 "Lt! QT! FGwlFT DFcRTa; watchfully aFcDW.\n",
192 "La! QT! FGwlFT DFtRTr; wrathfully rFtDW.\n",
193 "Lo! QT! FGwlFT DFnRTr; wrongfully rFnDW.\n"
194 ]
195 }
196 ],
197 "prompt_number": 20
198 },
199 {
200 "cell_type": "code",
201 "collapsed": false,
202 "input": [
203 "ct"
204 ],
205 "language": "python",
206 "metadata": {},
207 "outputs": [
208 {
209 "metadata": {},
210 "output_type": "pyout",
211 "prompt_number": 21,
212 "text": [
213 "'LJ! Qt! Fghxft dferts; hsjeukaxxn sfedw.'"
214 ]
215 }
216 ],
217 "prompt_number": 21
218 },
219 {
220 "cell_type": "code",
221 "collapsed": false,
222 "input": [
223 "for s4 in seeds4:\n",
224 " for s2 in seeds2:\n",
225 " if s2[2] == s4[0] and s2[3] == s4[8]:\n",
226 " transdict = {f: t for f, t in zip(ctu4 + ctu2, s4 + s2)}\n",
227 " if len(set(transdict.values())) == len(transdict):\n",
228 " print(ctu.translate(''.maketrans(transdict)))"
229 ],
230 "language": "python",
231 "metadata": {},
232 "outputs": [
233 {
234 "output_type": "stream",
235 "stream": "stdout",
236 "text": [
237 "Lo! Qs! phelps DptRsr; erotically rptDW.\n",
238 "Lo! Qs! phelps DptRsx; exotically xptDW.\n",
239 "Lf! Qd! exiled DeoRdn; informally neoDW.\n",
240 "Lf! Qs! exiles DeoRsn; informally neoDW.\n",
241 "Lg! Qs! nylons DnhRsi; lightproof inhDW.\n",
242 "Le! Qg! unplug DutRgo; poetically outDW.\n",
243 "Lg! Qs! earles DehRsi; rightfully iehDW.\n"
244 ]
245 }
246 ],
247 "prompt_number": 25
248 },
249 {
250 "cell_type": "code",
251 "collapsed": false,
252 "input": [
253 "for s4 in seeds4:\n",
254 " for s2 in seeds2:\n",
255 " if s2[2] == s4[0] and s2[3] == s4[8]:\n",
256 " for s3 in seeds3:\n",
257 " if s3[1] == s2[0] and s3[2] == s4[3] and s3[4] == s2[5] and s3[5] == s4[1]:\n",
258 " transdict = {f: t for f, t in zip(ctu4 + ctu2 + ctu3, s4 + s2 + s3)}\n",
259 " if len(set(transdict.values())) == len(transdict):\n",
260 " print(ctu.translate(''.maketrans(transdict)))"
261 ],
262 "language": "python",
263 "metadata": {},
264 "outputs": [],
265 "prompt_number": 28
266 },
267 {
268 "cell_type": "code",
269 "collapsed": false,
270 "input": [],
271 "language": "python",
272 "metadata": {},
273 "outputs": []
274 }
275 ],
276 "metadata": {}
277 }
278 ]
279 }