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