annotate content/Coding/029-announcing-my-purple-simulator.rst @ 22:a893739e9587

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