Tweaked slide layout
[cipher-training.git] / slides / pocket-enigma-break.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Breaking the pocket enigma</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6 <style type="text/css">
7 /* Slideshow styles */
8 body {
9 font-size: 20px;
10 }
11 h1, h2, h3 {
12 font-weight: 400;
13 margin-bottom: 0;
14 }
15 h1 { font-size: 3em; }
16 h2 { font-size: 2em; }
17 h3 { font-size: 1.6em; }
18 a, a > code {
19 text-decoration: none;
20 }
21 code {
22 -moz-border-radius: 5px;
23 -web-border-radius: 5px;
24 background: #e7e8e2;
25 border-radius: 5px;
26 font-size: 16px;
27 }
28 .plaintext {
29 background: #272822;
30 color: #80ff80;
31 text-shadow: 0 0 20px #333;
32 padding: 2px 5px;
33 }
34 .ciphertext {
35 background: #272822;
36 color: #ff6666;
37 text-shadow: 0 0 20px #333;
38 padding: 2px 5px;
39 }
40 .indexlink {
41 position: absolute;
42 bottom: 1em;
43 left: 1em;
44 }
45 .float-right {
46 float: right;
47 }
48 </style>
49 </head>
50 <body>
51 <textarea id="source">
52
53 # Breaking the Pocket Enigma
54
55 ![centre-aligned Pocket Engima](pocket-enigma-small.jpg)
56
57 Using cribs
58
59 ---
60
61 layout: true
62
63 .indexlink[[Index](index.html)]
64
65 ---
66
67 # Breaking the Pocket Enigma
68
69 A _crib_ is a piece of plaintext we believe to be in the enciphered message.
70
71 This is the way Enigma messages were broken in WWII.
72
73 There are many keys, and doing the naïve Bayes analysis was too expensive.
74
75 The possible keys were filtered by finding the ones that could have produced the crib. These filtered keys could then be checked manually.
76
77 At Bletchley Park, the filtering was done by the Bombes.
78
79 ---
80
81 # Breaking by cribs
82
83 ```
84 Given a message, a wheel spec, a crib, and the location of that crib:
85 Go through each key in turn
86 If the plaintext matches the crib:
87 Add it to the list of possible keys
88 Return the possible keys
89 ```
90
91 ## Example
92 ```python
93 pocket_enigma_break_by_crib('kzpjlzmoga', 1, 'l', 3)
94 ['a', 'j', 'n']
95 ```
96
97 Using wheel 1, the `j` (`ciphertext[3]`) could become `l` if the wheel starts the message on a, j, or n.
98
99 </textarea>
100 <script src="http://gnab.github.io/remark/downloads/remark-0.6.0.min.js" type="text/javascript">
101 </script>
102
103 <script type="text/javascript"
104 src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&delayStartupUntil=configured"></script>
105
106 <script type="text/javascript">
107 var slideshow = remark.create({ ratio: "16:9" });
108
109 // Setup MathJax
110 MathJax.Hub.Config({
111 tex2jax: {
112 skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
113 }
114 });
115 MathJax.Hub.Queue(function() {
116 $(MathJax.Hub.getAllJax()).map(function(index, elem) {
117 return(elem.SourceElement());
118 }).parent().addClass('has-jax');
119 });
120 MathJax.Hub.Configured();
121 </script>
122 </body>
123 </html>