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