comparison content/Coding/029-announcing-my-purple-simulator.rst @ 14:6e0d4799796d

Added a blog post about my PURPLE simulator. Created the simulator tag.
author Brian Neal <bgneal@gmail.com>
date Thu, 20 Feb 2014 19:47:19 -0600
parents
children
comparison
equal deleted inserted replaced
13:bcfe2a2c8358 14:6e0d4799796d
1 Announcing my Purple simulator
2 ##############################
3
4 :date: 2014-02-20 19:59
5 :tags: Python, m209, Enigma, Purple, simulator
6 :slug: announcing-my-purple-simulator
7 :author: Brian Neal
8 :Summary: I recently created a simulation of the Japanese PURPLE cipher machine
9 in Python.
10
11 After working on a `M-209 simulator`_ last summer and an `Enigma simulator`_ the
12 year before, I got the World War 2 era cipher machine bug again. It all started
13 by reading about the `Japanese PURPLE machine`_ at Frode Weierud's excellent
14 CryptoCellar_ website. I read with great interest a paper available at that
15 site titled *PURPLE Revealed: Simulation and Computer-aided Cryptanalysis of
16 Angooki Taipu B* by Wes Freeman, Geof Sullivan, and Frode Weierud. This paper
17 is a fascinating read, with detailed descriptions of how the machine worked,
18 the complicated keying system employed by the Japanese, and information on
19 using a technique known as *hill-climbing* to mount a ciphertext only attack on
20 a messages. Highly recommended!
21
22 After reading the paper I knew I had to try to write a simulator for the PUPRLE
23 machine in Python_. Writing these simulators is great fun. You have to
24 understand how the machine works, get a bunch of tiny details correct, have
25 a bit of patience, and do a lot of detective work and debugging. Once you have
26 them built, they aren't all that complicated when coded on a modern computer.
27 But you get an amazing appreciation for these machines as originally
28 implemented as electro-mechanical devices. The PURPLE machine, for example,
29 required almost 2,000 wired connections! It is even more amazing when you know
30 the U.S. code breakers built replicas without even seeing an original Japanese
31 machine. When the war ended, only a few parts of one Japanese machine were ever
32 recovered!
33
34 I had a lot of fun writing this and playing with it. I hope someone else finds
35 it interesting or educational. Please contact me and let me know if you use it
36 for anything. Please see these links for documentation, the code, and licensing
37 details:
38
39 * `Purple simulator on PyPI`_
40 * `Purple simulator on Bitbucket`_
41
42 Once again, many thanks to Frode Weierud, Geoff Sullivan, and Wes Sullivan for
43 the very interesting paper. I'm also grateful to Messrs. Weierud and Sullivan
44 who provided me with valuable plaintext, advice and encouragement while
45 I worked on this project.
46
47 I also recommend the book *Battle of Wits: The Complete Story of Codebreaking
48 in World War II* by Stephen Budiansky, which details the efforts and the people
49 behind the cracking of the PURPLE cipher.
50
51 .. _M-209 simulator: https://m209.readthedocs.org/en/latest/
52 .. _Enigma simulator: http://py-enigma.readthedocs.org/en/latest/
53 .. _Japanese PURPLE machine: http://cryptocellar.web.cern.ch/cryptocellar/simula/purple/
54 .. _CryptoCellar: http://cryptocellar.web.cern.ch/cryptocellar/
55 .. _Python: http://www.python.org/
56 .. _Purple simulator on PyPI: https://pypi.python.org/pypi/purple
57 .. _Purple simulator on Bitbucket: https://bitbucket.org/bgneal/purple/