Started on documentation
[szyfrow.git] / docs / szyfrow / amsco.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
6 <meta name="generator" content="pdoc 0.9.2" />
7 <title>szyfrow.amsco API documentation</title>
8 <meta name="description" content="Enciphering and deciphering using the [Amsco cipher](http://ericbrandel.com/2016/10/09/the-amsco-cipher/).
9 Also attempts to break messages that use …" />
10 <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
11 <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
12 <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
13 <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
14 <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
15 <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
16 <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
17 <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
18 </head>
19 <body>
20 <main>
21 <article id="content">
22 <header>
23 <h1 class="title">Module <code>szyfrow.amsco</code></h1>
24 </header>
25 <section id="section-intro">
26 <p>Enciphering and deciphering using the <a href="http://ericbrandel.com/2016/10/09/the-amsco-cipher/">Amsco cipher</a>.
27 Also attempts to break messages that use an Amsco cipher.</p>
28 <p>The Amsco cipher is a column transpositoin cipher. The plaintext is laid out,
29 row by row, into columns. However, different numbers of letters are laid out
30 in each cell, typically in a 1-2 pattern.</p>
31 <p>It's clearer with an example. Consider we're using the keyword "perceptive",
32 which turns into "perctiv". The text ""It is a truth universally
33 acknowledged, that a single man in, possession of a good fortune, must be in
34 want of a wife." is laid out in seven columns like this:</p>
35 <pre><code>p e r c t i v
36 --------------------
37 i ti s at r ut h
38 un i ve r sa l ly
39 a ck n ow l ed g
40 ed t ha t as i ng
41 l em a ni n po s
42 se s si o no f ag
43 o od f or t un e
44 mu s tb e in w an
45 t of a wi f e
46 </code></pre>
47 <p>The ciphertext is read out in columns, according to the order of the keyword.
48 In this example, the "c" column is read first, then the "e" column, and so on.
49 That gives the ciphertext of "atrowtnioorewi tiicktemsodsof utledipofunwe
50 iunaedlseomut svenhaasiftba rsalasnnotinf hlygngsagean".</p>
51 <details class="source">
52 <summary>
53 <span>Expand source code</span>
54 </summary>
55 <pre><code class="python">&#34;&#34;&#34;Enciphering and deciphering using the [Amsco cipher](http://ericbrandel.com/2016/10/09/the-amsco-cipher/).
56 Also attempts to break messages that use an Amsco cipher.
57
58 The Amsco cipher is a column transpositoin cipher. The plaintext is laid out,
59 row by row, into columns. However, different numbers of letters are laid out
60 in each cell, typically in a 1-2 pattern.
61
62 It&#39;s clearer with an example. Consider we&#39;re using the keyword &#34;perceptive&#34;,
63 which turns into &#34;perctiv&#34;. The text &#34;&#34;It is a truth universally
64 acknowledged, that a single man in, possession of a good fortune, must be in
65 want of a wife.&#34; is laid out in seven columns like this:
66
67 p e r c t i v
68 --------------------
69 i ti s at r ut h
70 un i ve r sa l ly
71 a ck n ow l ed g
72 ed t ha t as i ng
73 l em a ni n po s
74 se s si o no f ag
75 o od f or t un e
76 mu s tb e in w an
77 t of a wi f e
78
79 The ciphertext is read out in columns, according to the order of the keyword.
80 In this example, the &#34;c&#34; column is read first, then the &#34;e&#34; column, and so on.
81 That gives the ciphertext of &#34;atrowtnioorewi tiicktemsodsof utledipofunwe
82 iunaedlseomut svenhaasiftba rsalasnnotinf hlygngsagean&#34;.
83 &#34;&#34;&#34;
84
85 from enum import Enum
86 import multiprocessing
87 import itertools
88
89 from szyfrow.support.utilities import *
90 from szyfrow.support.language_models import *
91
92 __pdoc__ = {}
93
94 AmscoSlice = collections.namedtuple(&#39;AmscoSlice&#39;, [&#39;index&#39;, &#39;start&#39;, &#39;end&#39;])
95 __pdoc__[&#39;AmscoSlice&#39;] = &#34;&#34;&#34;Where each piece of plainatext ends up in the AMSCO
96 transpositon cipher.&#34;&#34;&#34;
97 __pdoc__[&#39;AmscoSlice.index&#39;] = &#34;&#34;&#34;Where the slice appears in the plaintext&#34;&#34;&#34;
98 __pdoc__[&#39;AmscoSlice.start&#39;] = &#34;&#34;&#34;Where the slice starts in the plaintext&#34;&#34;&#34;
99 __pdoc__[&#39;AmscoSlice.end&#39;] = &#34;&#34;&#34;Where the slice ends in the plaintext&#34;&#34;&#34;
100
101 class AmscoFillStyle(Enum):
102 &#34;&#34;&#34;Different methods of filling the grid.
103 * `continuous`: continue the fillpattern unbroken by row boundaries
104 * `same_each_row`: each row has the same fillpattern
105 * `reverse_each_row`: each row has the reversed fillpattern to the row above
106 &#34;&#34;&#34;
107 continuous = 1
108 same_each_row = 2
109 reverse_each_row = 3
110
111 def amsco_positions(message, keyword,
112 fillpattern=(1, 2),
113 fillstyle=AmscoFillStyle.continuous,
114 fillcolumnwise=False,
115 emptycolumnwise=True):
116 &#34;&#34;&#34;Creates the grid for the AMSCO transposition cipher. Each element in the
117 grid shows the index of that slice and the start and end positions of the
118 plaintext that go to make it up.
119
120 &gt;&gt;&gt; amsco_positions(string.ascii_lowercase, &#39;freddy&#39;, \
121 fillpattern=(1, 2)) # doctest: +NORMALIZE_WHITESPACE
122 [[AmscoSlice(index=3, start=4, end=6),
123 AmscoSlice(index=2, start=3, end=4),
124 AmscoSlice(index=0, start=0, end=1),
125 AmscoSlice(index=1, start=1, end=3),
126 AmscoSlice(index=4, start=6, end=7)],
127 [AmscoSlice(index=8, start=12, end=13),
128 AmscoSlice(index=7, start=10, end=12),
129 AmscoSlice(index=5, start=7, end=9),
130 AmscoSlice(index=6, start=9, end=10),
131 AmscoSlice(index=9, start=13, end=15)],
132 [AmscoSlice(index=13, start=19, end=21),
133 AmscoSlice(index=12, start=18, end=19),
134 AmscoSlice(index=10, start=15, end=16),
135 AmscoSlice(index=11, start=16, end=18),
136 AmscoSlice(index=14, start=21, end=22)],
137 [AmscoSlice(index=18, start=27, end=28),
138 AmscoSlice(index=17, start=25, end=27),
139 AmscoSlice(index=15, start=22, end=24),
140 AmscoSlice(index=16, start=24, end=25),
141 AmscoSlice(index=19, start=28, end=30)]]
142 &#34;&#34;&#34;
143 transpositions = transpositions_of(keyword)
144 fill_iterator = itertools.cycle(fillpattern)
145 indices = itertools.count()
146 message_length = len(message)
147
148 current_position = 0
149 grid = []
150 current_fillpattern = fillpattern
151 while current_position &lt; message_length:
152 row = []
153 if fillstyle == AmscoFillStyle.same_each_row:
154 fill_iterator = itertools.cycle(fillpattern)
155 if fillstyle == AmscoFillStyle.reverse_each_row:
156 fill_iterator = itertools.cycle(current_fillpattern)
157 for _ in range(len(transpositions)):
158 index = next(indices)
159 gap = next(fill_iterator)
160 row += [AmscoSlice(index, current_position, current_position + gap)]
161 current_position += gap
162 grid += [row]
163 if fillstyle == AmscoFillStyle.reverse_each_row:
164 current_fillpattern = list(reversed(current_fillpattern))
165 return [transpose(r, transpositions) for r in grid]
166
167 def amsco_encipher(message, keyword,
168 fillpattern=(1,2), fillstyle=AmscoFillStyle.reverse_each_row):
169 &#34;&#34;&#34;AMSCO transposition encipher.
170
171 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;abc&#39;, fillpattern=(1, 2))
172 &#39;hoteelhler&#39;
173 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;abc&#39;, fillpattern=(2, 1))
174 &#39;hetelhelor&#39;
175 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;acb&#39;, fillpattern=(1, 2))
176 &#39;hotelerelh&#39;
177 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;acb&#39;, fillpattern=(2, 1))
178 &#39;hetelorlhe&#39;
179 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;encode&#39;)
180 &#39;etecstthhomoerereenisxip&#39;
181 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 2))
182 &#39;hetcsoeisterereipexthomn&#39;
183 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
184 &#39;hecsoisttererteipexhomen&#39;
185 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(2, 1))
186 &#39;heecisoosttrrtepeixhemen&#39;
187 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2))
188 &#39;hxtomephescieretoeisnter&#39;
189 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
190 &#39;hxomeiphscerettoisenteer&#39;
191 &#34;&#34;&#34;
192 grid = amsco_positions(message, keyword,
193 fillpattern=fillpattern, fillstyle=fillstyle)
194 ct_as_grid = [[message[s.start:s.end] for s in r] for r in grid]
195 return combine_every_nth(ct_as_grid)
196
197
198 def amsco_decipher(message, keyword,
199 fillpattern=(1,2), fillstyle=AmscoFillStyle.reverse_each_row):
200 &#34;&#34;&#34;AMSCO transposition decipher
201
202 &gt;&gt;&gt; amsco_decipher(&#39;hoteelhler&#39;, &#39;abc&#39;, fillpattern=(1, 2))
203 &#39;hellothere&#39;
204 &gt;&gt;&gt; amsco_decipher(&#39;hetelhelor&#39;, &#39;abc&#39;, fillpattern=(2, 1))
205 &#39;hellothere&#39;
206 &gt;&gt;&gt; amsco_decipher(&#39;hotelerelh&#39;, &#39;acb&#39;, fillpattern=(1, 2))
207 &#39;hellothere&#39;
208 &gt;&gt;&gt; amsco_decipher(&#39;hetelorlhe&#39;, &#39;acb&#39;, fillpattern=(2, 1))
209 &#39;hellothere&#39;
210 &gt;&gt;&gt; amsco_decipher(&#39;etecstthhomoerereenisxip&#39;, &#39;encode&#39;)
211 &#39;hereissometexttoencipher&#39;
212 &gt;&gt;&gt; amsco_decipher(&#39;hetcsoeisterereipexthomn&#39;, &#39;cipher&#39;, fillpattern=(1, 2))
213 &#39;hereissometexttoencipher&#39;
214 &gt;&gt;&gt; amsco_decipher(&#39;hecsoisttererteipexhomen&#39;, &#39;cipher&#39;, fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
215 &#39;hereissometexttoencipher&#39;
216 &gt;&gt;&gt; amsco_decipher(&#39;heecisoosttrrtepeixhemen&#39;, &#39;cipher&#39;, fillpattern=(2, 1))
217 &#39;hereissometexttoencipher&#39;
218 &gt;&gt;&gt; amsco_decipher(&#39;hxtomephescieretoeisnter&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2))
219 &#39;hereissometexttoencipher&#39;
220 &gt;&gt;&gt; amsco_decipher(&#39;hxomeiphscerettoisenteer&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
221 &#39;hereissometexttoencipher&#39;
222 &#34;&#34;&#34;
223
224 grid = amsco_positions(message, keyword,
225 fillpattern=fillpattern, fillstyle=fillstyle)
226 transposed_sections = [s for c in [l for l in zip(*grid)] for s in c]
227 plaintext_list = [&#39;&#39;] * len(transposed_sections)
228 current_pos = 0
229 for slice in transposed_sections:
230 plaintext_list[slice.index] = message[current_pos:current_pos-slice.start+slice.end][:len(message[slice.start:slice.end])]
231 current_pos += len(message[slice.start:slice.end])
232 return cat(plaintext_list)
233
234
235 def amsco_break(message, translist=None, patterns = [(1, 2), (2, 1)],
236 fillstyles = [AmscoFillStyle.continuous,
237 AmscoFillStyle.same_each_row,
238 AmscoFillStyle.reverse_each_row],
239 fitness=Pbigrams,
240 chunksize=500):
241 &#34;&#34;&#34;Breaks an AMSCO transposition cipher using a dictionary and
242 n-gram frequency analysis.
243
244 If `translist` is not specified, use
245 [`szyfrow.support.langauge_models.transpositions`](support/language_models.html#szyfrow.support.language_models.transpositions).
246
247 &gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( \
248 &#34;It is a truth universally acknowledged, that a single man in \
249 possession of a good fortune, must be in want of a wife. However \
250 little known the feelings or views of such a man may be on his \
251 first entering a neighbourhood, this truth is so well fixed in \
252 the minds of the surrounding families, that he is considered the \
253 rightful property of some one or other of their daughters.&#34;), \
254 &#39;encipher&#39;), \
255 translist={(2, 0, 5, 3, 1, 4, 6): [&#39;encipher&#39;], \
256 (5, 0, 6, 1, 3, 4, 2): [&#39;fourteen&#39;], \
257 (6, 1, 0, 4, 5, 3, 2): [&#39;keyword&#39;]}, \
258 patterns=[(1, 2)]) # doctest: +ELLIPSIS
259 (((2, 0, 5, 3, 1, 4, 6), (1, 2), &lt;AmscoFillStyle.continuous: 1&gt;), -709.4646722...)
260 &gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( \
261 &#34;It is a truth universally acknowledged, that a single man in \
262 possession of a good fortune, must be in want of a wife. However \
263 little known the feelings or views of such a man may be on his \
264 first entering a neighbourhood, this truth is so well fixed in \
265 the minds of the surrounding families, that he is considered the \
266 rightful property of some one or other of their daughters.&#34;), \
267 &#39;encipher&#39;, fillpattern=(2, 1)), \
268 translist={(2, 0, 5, 3, 1, 4, 6): [&#39;encipher&#39;], \
269 (5, 0, 6, 1, 3, 4, 2): [&#39;fourteen&#39;], \
270 (6, 1, 0, 4, 5, 3, 2): [&#39;keyword&#39;]}, \
271 patterns=[(1, 2), (2, 1)], fitness=Ptrigrams) # doctest: +ELLIPSIS
272 (((2, 0, 5, 3, 1, 4, 6), (2, 1), &lt;AmscoFillStyle.continuous: 1&gt;), -997.0129085...)
273 &#34;&#34;&#34;
274 if translist is None:
275 translist = transpositions
276
277 with multiprocessing.Pool() as pool:
278 helper_args = [(message, trans, pattern, fillstyle, fitness)
279 for trans in translist
280 for pattern in patterns
281 for fillstyle in fillstyles]
282 # Gotcha: the helper function here needs to be defined at the top level
283 # (limitation of Pool.starmap)
284 breaks = pool.starmap(amsco_break_worker, helper_args, chunksize)
285 return max(breaks, key=lambda k: k[1])
286
287 def amsco_break_worker(message, transposition,
288 pattern, fillstyle, fitness):
289 plaintext = amsco_decipher(message, transposition,
290 fillpattern=pattern, fillstyle=fillstyle)
291 fit = fitness(sanitise(plaintext))
292 return (transposition, pattern, fillstyle), fit
293
294 if __name__ == &#34;__main__&#34;:
295 import doctest</code></pre>
296 </details>
297 </section>
298 <section>
299 </section>
300 <section>
301 </section>
302 <section>
303 <h2 class="section-title" id="header-functions">Functions</h2>
304 <dl>
305 <dt id="szyfrow.amsco.amsco_break"><code class="name flex">
306 <span>def <span class="ident">amsco_break</span></span>(<span>message, translist=None, patterns=[(1, 2), (2, 1)], fillstyles=[&lt;AmscoFillStyle.continuous: 1&gt;, &lt;AmscoFillStyle.same_each_row: 2&gt;, &lt;AmscoFillStyle.reverse_each_row: 3&gt;], fitness=&lt;function Pbigrams&gt;, chunksize=500)</span>
307 </code></dt>
308 <dd>
309 <div class="desc"><p>Breaks an AMSCO transposition cipher using a dictionary and
310 n-gram frequency analysis.</p>
311 <p>If <code>translist</code> is not specified, use
312 <a href="support/language_models.html#szyfrow.support.language_models.transpositions"><code>szyfrow.support.langauge_models.transpositions</code></a>.</p>
313 <pre><code class="language-python-repl">&gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( &quot;It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered the rightful property of some one or other of their daughters.&quot;), 'encipher'), translist={(2, 0, 5, 3, 1, 4, 6): ['encipher'], (5, 0, 6, 1, 3, 4, 2): ['fourteen'], (6, 1, 0, 4, 5, 3, 2): ['keyword']}, patterns=[(1, 2)]) # doctest: +ELLIPSIS
314 (((2, 0, 5, 3, 1, 4, 6), (1, 2), &lt;AmscoFillStyle.continuous: 1&gt;), -709.4646722...)
315 &gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( &quot;It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered the rightful property of some one or other of their daughters.&quot;), 'encipher', fillpattern=(2, 1)), translist={(2, 0, 5, 3, 1, 4, 6): ['encipher'], (5, 0, 6, 1, 3, 4, 2): ['fourteen'], (6, 1, 0, 4, 5, 3, 2): ['keyword']}, patterns=[(1, 2), (2, 1)], fitness=Ptrigrams) # doctest: +ELLIPSIS
316 (((2, 0, 5, 3, 1, 4, 6), (2, 1), &lt;AmscoFillStyle.continuous: 1&gt;), -997.0129085...)
317 </code></pre></div>
318 <details class="source">
319 <summary>
320 <span>Expand source code</span>
321 </summary>
322 <pre><code class="python">def amsco_break(message, translist=None, patterns = [(1, 2), (2, 1)],
323 fillstyles = [AmscoFillStyle.continuous,
324 AmscoFillStyle.same_each_row,
325 AmscoFillStyle.reverse_each_row],
326 fitness=Pbigrams,
327 chunksize=500):
328 &#34;&#34;&#34;Breaks an AMSCO transposition cipher using a dictionary and
329 n-gram frequency analysis.
330
331 If `translist` is not specified, use
332 [`szyfrow.support.langauge_models.transpositions`](support/language_models.html#szyfrow.support.language_models.transpositions).
333
334 &gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( \
335 &#34;It is a truth universally acknowledged, that a single man in \
336 possession of a good fortune, must be in want of a wife. However \
337 little known the feelings or views of such a man may be on his \
338 first entering a neighbourhood, this truth is so well fixed in \
339 the minds of the surrounding families, that he is considered the \
340 rightful property of some one or other of their daughters.&#34;), \
341 &#39;encipher&#39;), \
342 translist={(2, 0, 5, 3, 1, 4, 6): [&#39;encipher&#39;], \
343 (5, 0, 6, 1, 3, 4, 2): [&#39;fourteen&#39;], \
344 (6, 1, 0, 4, 5, 3, 2): [&#39;keyword&#39;]}, \
345 patterns=[(1, 2)]) # doctest: +ELLIPSIS
346 (((2, 0, 5, 3, 1, 4, 6), (1, 2), &lt;AmscoFillStyle.continuous: 1&gt;), -709.4646722...)
347 &gt;&gt;&gt; amsco_break(amsco_encipher(sanitise( \
348 &#34;It is a truth universally acknowledged, that a single man in \
349 possession of a good fortune, must be in want of a wife. However \
350 little known the feelings or views of such a man may be on his \
351 first entering a neighbourhood, this truth is so well fixed in \
352 the minds of the surrounding families, that he is considered the \
353 rightful property of some one or other of their daughters.&#34;), \
354 &#39;encipher&#39;, fillpattern=(2, 1)), \
355 translist={(2, 0, 5, 3, 1, 4, 6): [&#39;encipher&#39;], \
356 (5, 0, 6, 1, 3, 4, 2): [&#39;fourteen&#39;], \
357 (6, 1, 0, 4, 5, 3, 2): [&#39;keyword&#39;]}, \
358 patterns=[(1, 2), (2, 1)], fitness=Ptrigrams) # doctest: +ELLIPSIS
359 (((2, 0, 5, 3, 1, 4, 6), (2, 1), &lt;AmscoFillStyle.continuous: 1&gt;), -997.0129085...)
360 &#34;&#34;&#34;
361 if translist is None:
362 translist = transpositions
363
364 with multiprocessing.Pool() as pool:
365 helper_args = [(message, trans, pattern, fillstyle, fitness)
366 for trans in translist
367 for pattern in patterns
368 for fillstyle in fillstyles]
369 # Gotcha: the helper function here needs to be defined at the top level
370 # (limitation of Pool.starmap)
371 breaks = pool.starmap(amsco_break_worker, helper_args, chunksize)
372 return max(breaks, key=lambda k: k[1])</code></pre>
373 </details>
374 </dd>
375 <dt id="szyfrow.amsco.amsco_break_worker"><code class="name flex">
376 <span>def <span class="ident">amsco_break_worker</span></span>(<span>message, transposition, pattern, fillstyle, fitness)</span>
377 </code></dt>
378 <dd>
379 <div class="desc"></div>
380 <details class="source">
381 <summary>
382 <span>Expand source code</span>
383 </summary>
384 <pre><code class="python">def amsco_break_worker(message, transposition,
385 pattern, fillstyle, fitness):
386 plaintext = amsco_decipher(message, transposition,
387 fillpattern=pattern, fillstyle=fillstyle)
388 fit = fitness(sanitise(plaintext))
389 return (transposition, pattern, fillstyle), fit</code></pre>
390 </details>
391 </dd>
392 <dt id="szyfrow.amsco.amsco_decipher"><code class="name flex">
393 <span>def <span class="ident">amsco_decipher</span></span>(<span>message, keyword, fillpattern=(1, 2), fillstyle=AmscoFillStyle.reverse_each_row)</span>
394 </code></dt>
395 <dd>
396 <div class="desc"><p>AMSCO transposition decipher</p>
397 <pre><code class="language-python-repl">&gt;&gt;&gt; amsco_decipher('hoteelhler', 'abc', fillpattern=(1, 2))
398 'hellothere'
399 &gt;&gt;&gt; amsco_decipher('hetelhelor', 'abc', fillpattern=(2, 1))
400 'hellothere'
401 &gt;&gt;&gt; amsco_decipher('hotelerelh', 'acb', fillpattern=(1, 2))
402 'hellothere'
403 &gt;&gt;&gt; amsco_decipher('hetelorlhe', 'acb', fillpattern=(2, 1))
404 'hellothere'
405 &gt;&gt;&gt; amsco_decipher('etecstthhomoerereenisxip', 'encode')
406 'hereissometexttoencipher'
407 &gt;&gt;&gt; amsco_decipher('hetcsoeisterereipexthomn', 'cipher', fillpattern=(1, 2))
408 'hereissometexttoencipher'
409 &gt;&gt;&gt; amsco_decipher('hecsoisttererteipexhomen', 'cipher', fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
410 'hereissometexttoencipher'
411 &gt;&gt;&gt; amsco_decipher('heecisoosttrrtepeixhemen', 'cipher', fillpattern=(2, 1))
412 'hereissometexttoencipher'
413 &gt;&gt;&gt; amsco_decipher('hxtomephescieretoeisnter', 'cipher', fillpattern=(1, 3, 2))
414 'hereissometexttoencipher'
415 &gt;&gt;&gt; amsco_decipher('hxomeiphscerettoisenteer', 'cipher', fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
416 'hereissometexttoencipher'
417 </code></pre></div>
418 <details class="source">
419 <summary>
420 <span>Expand source code</span>
421 </summary>
422 <pre><code class="python">def amsco_decipher(message, keyword,
423 fillpattern=(1,2), fillstyle=AmscoFillStyle.reverse_each_row):
424 &#34;&#34;&#34;AMSCO transposition decipher
425
426 &gt;&gt;&gt; amsco_decipher(&#39;hoteelhler&#39;, &#39;abc&#39;, fillpattern=(1, 2))
427 &#39;hellothere&#39;
428 &gt;&gt;&gt; amsco_decipher(&#39;hetelhelor&#39;, &#39;abc&#39;, fillpattern=(2, 1))
429 &#39;hellothere&#39;
430 &gt;&gt;&gt; amsco_decipher(&#39;hotelerelh&#39;, &#39;acb&#39;, fillpattern=(1, 2))
431 &#39;hellothere&#39;
432 &gt;&gt;&gt; amsco_decipher(&#39;hetelorlhe&#39;, &#39;acb&#39;, fillpattern=(2, 1))
433 &#39;hellothere&#39;
434 &gt;&gt;&gt; amsco_decipher(&#39;etecstthhomoerereenisxip&#39;, &#39;encode&#39;)
435 &#39;hereissometexttoencipher&#39;
436 &gt;&gt;&gt; amsco_decipher(&#39;hetcsoeisterereipexthomn&#39;, &#39;cipher&#39;, fillpattern=(1, 2))
437 &#39;hereissometexttoencipher&#39;
438 &gt;&gt;&gt; amsco_decipher(&#39;hecsoisttererteipexhomen&#39;, &#39;cipher&#39;, fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
439 &#39;hereissometexttoencipher&#39;
440 &gt;&gt;&gt; amsco_decipher(&#39;heecisoosttrrtepeixhemen&#39;, &#39;cipher&#39;, fillpattern=(2, 1))
441 &#39;hereissometexttoencipher&#39;
442 &gt;&gt;&gt; amsco_decipher(&#39;hxtomephescieretoeisnter&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2))
443 &#39;hereissometexttoencipher&#39;
444 &gt;&gt;&gt; amsco_decipher(&#39;hxomeiphscerettoisenteer&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
445 &#39;hereissometexttoencipher&#39;
446 &#34;&#34;&#34;
447
448 grid = amsco_positions(message, keyword,
449 fillpattern=fillpattern, fillstyle=fillstyle)
450 transposed_sections = [s for c in [l for l in zip(*grid)] for s in c]
451 plaintext_list = [&#39;&#39;] * len(transposed_sections)
452 current_pos = 0
453 for slice in transposed_sections:
454 plaintext_list[slice.index] = message[current_pos:current_pos-slice.start+slice.end][:len(message[slice.start:slice.end])]
455 current_pos += len(message[slice.start:slice.end])
456 return cat(plaintext_list)</code></pre>
457 </details>
458 </dd>
459 <dt id="szyfrow.amsco.amsco_encipher"><code class="name flex">
460 <span>def <span class="ident">amsco_encipher</span></span>(<span>message, keyword, fillpattern=(1, 2), fillstyle=AmscoFillStyle.reverse_each_row)</span>
461 </code></dt>
462 <dd>
463 <div class="desc"><p>AMSCO transposition encipher.</p>
464 <pre><code class="language-python-repl">&gt;&gt;&gt; amsco_encipher('hellothere', 'abc', fillpattern=(1, 2))
465 'hoteelhler'
466 &gt;&gt;&gt; amsco_encipher('hellothere', 'abc', fillpattern=(2, 1))
467 'hetelhelor'
468 &gt;&gt;&gt; amsco_encipher('hellothere', 'acb', fillpattern=(1, 2))
469 'hotelerelh'
470 &gt;&gt;&gt; amsco_encipher('hellothere', 'acb', fillpattern=(2, 1))
471 'hetelorlhe'
472 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'encode')
473 'etecstthhomoerereenisxip'
474 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'cipher', fillpattern=(1, 2))
475 'hetcsoeisterereipexthomn'
476 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'cipher', fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
477 'hecsoisttererteipexhomen'
478 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'cipher', fillpattern=(2, 1))
479 'heecisoosttrrtepeixhemen'
480 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'cipher', fillpattern=(1, 3, 2))
481 'hxtomephescieretoeisnter'
482 &gt;&gt;&gt; amsco_encipher('hereissometexttoencipher', 'cipher', fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
483 'hxomeiphscerettoisenteer'
484 </code></pre></div>
485 <details class="source">
486 <summary>
487 <span>Expand source code</span>
488 </summary>
489 <pre><code class="python">def amsco_encipher(message, keyword,
490 fillpattern=(1,2), fillstyle=AmscoFillStyle.reverse_each_row):
491 &#34;&#34;&#34;AMSCO transposition encipher.
492
493 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;abc&#39;, fillpattern=(1, 2))
494 &#39;hoteelhler&#39;
495 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;abc&#39;, fillpattern=(2, 1))
496 &#39;hetelhelor&#39;
497 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;acb&#39;, fillpattern=(1, 2))
498 &#39;hotelerelh&#39;
499 &gt;&gt;&gt; amsco_encipher(&#39;hellothere&#39;, &#39;acb&#39;, fillpattern=(2, 1))
500 &#39;hetelorlhe&#39;
501 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;encode&#39;)
502 &#39;etecstthhomoerereenisxip&#39;
503 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 2))
504 &#39;hetcsoeisterereipexthomn&#39;
505 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous)
506 &#39;hecsoisttererteipexhomen&#39;
507 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(2, 1))
508 &#39;heecisoosttrrtepeixhemen&#39;
509 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2))
510 &#39;hxtomephescieretoeisnter&#39;
511 &gt;&gt;&gt; amsco_encipher(&#39;hereissometexttoencipher&#39;, &#39;cipher&#39;, fillpattern=(1, 3, 2), fillstyle=AmscoFillStyle.continuous)
512 &#39;hxomeiphscerettoisenteer&#39;
513 &#34;&#34;&#34;
514 grid = amsco_positions(message, keyword,
515 fillpattern=fillpattern, fillstyle=fillstyle)
516 ct_as_grid = [[message[s.start:s.end] for s in r] for r in grid]
517 return combine_every_nth(ct_as_grid)</code></pre>
518 </details>
519 </dd>
520 <dt id="szyfrow.amsco.amsco_positions"><code class="name flex">
521 <span>def <span class="ident">amsco_positions</span></span>(<span>message, keyword, fillpattern=(1, 2), fillstyle=AmscoFillStyle.continuous, fillcolumnwise=False, emptycolumnwise=True)</span>
522 </code></dt>
523 <dd>
524 <div class="desc"><p>Creates the grid for the AMSCO transposition cipher. Each element in the
525 grid shows the index of that slice and the start and end positions of the
526 plaintext that go to make it up.</p>
527 <pre><code class="language-python-repl">&gt;&gt;&gt; amsco_positions(string.ascii_lowercase, 'freddy', fillpattern=(1, 2)) # doctest: +NORMALIZE_WHITESPACE
528 [[AmscoSlice(index=3, start=4, end=6),
529 AmscoSlice(index=2, start=3, end=4),
530 AmscoSlice(index=0, start=0, end=1),
531 AmscoSlice(index=1, start=1, end=3),
532 AmscoSlice(index=4, start=6, end=7)],
533 [AmscoSlice(index=8, start=12, end=13),
534 AmscoSlice(index=7, start=10, end=12),
535 AmscoSlice(index=5, start=7, end=9),
536 AmscoSlice(index=6, start=9, end=10),
537 AmscoSlice(index=9, start=13, end=15)],
538 [AmscoSlice(index=13, start=19, end=21),
539 AmscoSlice(index=12, start=18, end=19),
540 AmscoSlice(index=10, start=15, end=16),
541 AmscoSlice(index=11, start=16, end=18),
542 AmscoSlice(index=14, start=21, end=22)],
543 [AmscoSlice(index=18, start=27, end=28),
544 AmscoSlice(index=17, start=25, end=27),
545 AmscoSlice(index=15, start=22, end=24),
546 AmscoSlice(index=16, start=24, end=25),
547 AmscoSlice(index=19, start=28, end=30)]]
548 </code></pre></div>
549 <details class="source">
550 <summary>
551 <span>Expand source code</span>
552 </summary>
553 <pre><code class="python">def amsco_positions(message, keyword,
554 fillpattern=(1, 2),
555 fillstyle=AmscoFillStyle.continuous,
556 fillcolumnwise=False,
557 emptycolumnwise=True):
558 &#34;&#34;&#34;Creates the grid for the AMSCO transposition cipher. Each element in the
559 grid shows the index of that slice and the start and end positions of the
560 plaintext that go to make it up.
561
562 &gt;&gt;&gt; amsco_positions(string.ascii_lowercase, &#39;freddy&#39;, \
563 fillpattern=(1, 2)) # doctest: +NORMALIZE_WHITESPACE
564 [[AmscoSlice(index=3, start=4, end=6),
565 AmscoSlice(index=2, start=3, end=4),
566 AmscoSlice(index=0, start=0, end=1),
567 AmscoSlice(index=1, start=1, end=3),
568 AmscoSlice(index=4, start=6, end=7)],
569 [AmscoSlice(index=8, start=12, end=13),
570 AmscoSlice(index=7, start=10, end=12),
571 AmscoSlice(index=5, start=7, end=9),
572 AmscoSlice(index=6, start=9, end=10),
573 AmscoSlice(index=9, start=13, end=15)],
574 [AmscoSlice(index=13, start=19, end=21),
575 AmscoSlice(index=12, start=18, end=19),
576 AmscoSlice(index=10, start=15, end=16),
577 AmscoSlice(index=11, start=16, end=18),
578 AmscoSlice(index=14, start=21, end=22)],
579 [AmscoSlice(index=18, start=27, end=28),
580 AmscoSlice(index=17, start=25, end=27),
581 AmscoSlice(index=15, start=22, end=24),
582 AmscoSlice(index=16, start=24, end=25),
583 AmscoSlice(index=19, start=28, end=30)]]
584 &#34;&#34;&#34;
585 transpositions = transpositions_of(keyword)
586 fill_iterator = itertools.cycle(fillpattern)
587 indices = itertools.count()
588 message_length = len(message)
589
590 current_position = 0
591 grid = []
592 current_fillpattern = fillpattern
593 while current_position &lt; message_length:
594 row = []
595 if fillstyle == AmscoFillStyle.same_each_row:
596 fill_iterator = itertools.cycle(fillpattern)
597 if fillstyle == AmscoFillStyle.reverse_each_row:
598 fill_iterator = itertools.cycle(current_fillpattern)
599 for _ in range(len(transpositions)):
600 index = next(indices)
601 gap = next(fill_iterator)
602 row += [AmscoSlice(index, current_position, current_position + gap)]
603 current_position += gap
604 grid += [row]
605 if fillstyle == AmscoFillStyle.reverse_each_row:
606 current_fillpattern = list(reversed(current_fillpattern))
607 return [transpose(r, transpositions) for r in grid]</code></pre>
608 </details>
609 </dd>
610 <dt id="szyfrow.amsco.cat"><code class="name flex">
611 <span>def <span class="ident">cat</span></span>(<span>iterable, /)</span>
612 </code></dt>
613 <dd>
614 <div class="desc"><p>Concatenate any number of strings.</p>
615 <p>The string whose method is called is inserted in between each given string.
616 The result is returned as a new string.</p>
617 <p>Example: '.'.join(['ab', 'pq', 'rs']) -&gt; 'ab.pq.rs'</p></div>
618 </dd>
619 <dt id="szyfrow.amsco.lcat"><code class="name flex">
620 <span>def <span class="ident">lcat</span></span>(<span>iterable, /)</span>
621 </code></dt>
622 <dd>
623 <div class="desc"><p>Concatenate any number of strings.</p>
624 <p>The string whose method is called is inserted in between each given string.
625 The result is returned as a new string.</p>
626 <p>Example: '.'.join(['ab', 'pq', 'rs']) -&gt; 'ab.pq.rs'</p></div>
627 </dd>
628 <dt id="szyfrow.amsco.wcat"><code class="name flex">
629 <span>def <span class="ident">wcat</span></span>(<span>iterable, /)</span>
630 </code></dt>
631 <dd>
632 <div class="desc"><p>Concatenate any number of strings.</p>
633 <p>The string whose method is called is inserted in between each given string.
634 The result is returned as a new string.</p>
635 <p>Example: '.'.join(['ab', 'pq', 'rs']) -&gt; 'ab.pq.rs'</p></div>
636 </dd>
637 </dl>
638 </section>
639 <section>
640 <h2 class="section-title" id="header-classes">Classes</h2>
641 <dl>
642 <dt id="szyfrow.amsco.AmscoFillStyle"><code class="flex name class">
643 <span>class <span class="ident">AmscoFillStyle</span></span>
644 <span>(</span><span>value, names=None, *, module=None, qualname=None, type=None, start=1)</span>
645 </code></dt>
646 <dd>
647 <div class="desc"><p>Different methods of filling the grid.
648 * <code>continuous</code>: continue the fillpattern unbroken by row boundaries
649 * <code>same_each_row</code>: each row has the same fillpattern
650 * <code>reverse_each_row</code>: each row has the reversed fillpattern to the row above</p></div>
651 <details class="source">
652 <summary>
653 <span>Expand source code</span>
654 </summary>
655 <pre><code class="python">class AmscoFillStyle(Enum):
656 &#34;&#34;&#34;Different methods of filling the grid.
657 * `continuous`: continue the fillpattern unbroken by row boundaries
658 * `same_each_row`: each row has the same fillpattern
659 * `reverse_each_row`: each row has the reversed fillpattern to the row above
660 &#34;&#34;&#34;
661 continuous = 1
662 same_each_row = 2
663 reverse_each_row = 3</code></pre>
664 </details>
665 <h3>Ancestors</h3>
666 <ul class="hlist">
667 <li>enum.Enum</li>
668 </ul>
669 <h3>Class variables</h3>
670 <dl>
671 <dt id="szyfrow.amsco.AmscoFillStyle.continuous"><code class="name">var <span class="ident">continuous</span></code></dt>
672 <dd>
673 <div class="desc"></div>
674 </dd>
675 <dt id="szyfrow.amsco.AmscoFillStyle.reverse_each_row"><code class="name">var <span class="ident">reverse_each_row</span></code></dt>
676 <dd>
677 <div class="desc"></div>
678 </dd>
679 <dt id="szyfrow.amsco.AmscoFillStyle.same_each_row"><code class="name">var <span class="ident">same_each_row</span></code></dt>
680 <dd>
681 <div class="desc"></div>
682 </dd>
683 </dl>
684 </dd>
685 <dt id="szyfrow.amsco.AmscoSlice"><code class="flex name class">
686 <span>class <span class="ident">AmscoSlice</span></span>
687 <span>(</span><span>index, start, end)</span>
688 </code></dt>
689 <dd>
690 <div class="desc"><p>Where each piece of plainatext ends up in the AMSCO
691 transpositon cipher.</p></div>
692 <h3>Ancestors</h3>
693 <ul class="hlist">
694 <li>builtins.tuple</li>
695 </ul>
696 <h3>Instance variables</h3>
697 <dl>
698 <dt id="szyfrow.amsco.AmscoSlice.end"><code class="name">var <span class="ident">end</span></code></dt>
699 <dd>
700 <div class="desc"><p>Where the slice ends in the plaintext</p></div>
701 </dd>
702 <dt id="szyfrow.amsco.AmscoSlice.index"><code class="name">var <span class="ident">index</span></code></dt>
703 <dd>
704 <div class="desc"><p>Where the slice appears in the plaintext</p></div>
705 </dd>
706 <dt id="szyfrow.amsco.AmscoSlice.start"><code class="name">var <span class="ident">start</span></code></dt>
707 <dd>
708 <div class="desc"><p>Where the slice starts in the plaintext</p></div>
709 </dd>
710 </dl>
711 </dd>
712 </dl>
713 </section>
714 </article>
715 <nav id="sidebar">
716 <h1>Index</h1>
717 <div class="toc">
718 <ul></ul>
719 </div>
720 <ul id="index">
721 <li><h3>Super-module</h3>
722 <ul>
723 <li><code><a title="szyfrow" href="index.html">szyfrow</a></code></li>
724 </ul>
725 </li>
726 <li><h3><a href="#header-functions">Functions</a></h3>
727 <ul class="two-column">
728 <li><code><a title="szyfrow.amsco.amsco_break" href="#szyfrow.amsco.amsco_break">amsco_break</a></code></li>
729 <li><code><a title="szyfrow.amsco.amsco_break_worker" href="#szyfrow.amsco.amsco_break_worker">amsco_break_worker</a></code></li>
730 <li><code><a title="szyfrow.amsco.amsco_decipher" href="#szyfrow.amsco.amsco_decipher">amsco_decipher</a></code></li>
731 <li><code><a title="szyfrow.amsco.amsco_encipher" href="#szyfrow.amsco.amsco_encipher">amsco_encipher</a></code></li>
732 <li><code><a title="szyfrow.amsco.amsco_positions" href="#szyfrow.amsco.amsco_positions">amsco_positions</a></code></li>
733 <li><code><a title="szyfrow.amsco.cat" href="#szyfrow.amsco.cat">cat</a></code></li>
734 <li><code><a title="szyfrow.amsco.lcat" href="#szyfrow.amsco.lcat">lcat</a></code></li>
735 <li><code><a title="szyfrow.amsco.wcat" href="#szyfrow.amsco.wcat">wcat</a></code></li>
736 </ul>
737 </li>
738 <li><h3><a href="#header-classes">Classes</a></h3>
739 <ul>
740 <li>
741 <h4><code><a title="szyfrow.amsco.AmscoFillStyle" href="#szyfrow.amsco.AmscoFillStyle">AmscoFillStyle</a></code></h4>
742 <ul class="">
743 <li><code><a title="szyfrow.amsco.AmscoFillStyle.continuous" href="#szyfrow.amsco.AmscoFillStyle.continuous">continuous</a></code></li>
744 <li><code><a title="szyfrow.amsco.AmscoFillStyle.reverse_each_row" href="#szyfrow.amsco.AmscoFillStyle.reverse_each_row">reverse_each_row</a></code></li>
745 <li><code><a title="szyfrow.amsco.AmscoFillStyle.same_each_row" href="#szyfrow.amsco.AmscoFillStyle.same_each_row">same_each_row</a></code></li>
746 </ul>
747 </li>
748 <li>
749 <h4><code><a title="szyfrow.amsco.AmscoSlice" href="#szyfrow.amsco.AmscoSlice">AmscoSlice</a></code></h4>
750 <ul class="">
751 <li><code><a title="szyfrow.amsco.AmscoSlice.end" href="#szyfrow.amsco.AmscoSlice.end">end</a></code></li>
752 <li><code><a title="szyfrow.amsco.AmscoSlice.index" href="#szyfrow.amsco.AmscoSlice.index">index</a></code></li>
753 <li><code><a title="szyfrow.amsco.AmscoSlice.start" href="#szyfrow.amsco.AmscoSlice.start">start</a></code></li>
754 </ul>
755 </li>
756 </ul>
757 </li>
758 </ul>
759 </nav>
760 </main>
761 <footer id="footer">
762 <p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.9.2</a>.</p>
763 </footer>
764 </body>
765 </html>