# Cryptography

#### Tag: modular arithmetic

Cryptonomicon by Neal Stephenson is an interesting and informative novel tying together different generations of cryptography.   A passage I found most interesting was in the chapter ‘Cycles’.  In this chapter, Stephenson expands on the fundamental mathematics behind the Enigma machine: modular arithmetic.

Stephenson compares modular arithmetic to Turing’s bike.  For some reason, Turing’s bike has a rear wheel with one bent spoke and a weak chain link.  When the spoke comes into contact with the chain at a certain position the chain will fall apart.  The mathematical take on this occurring utilizes a series of variables.  We assume that the spoke is at a degree of 0 (Θ=0) and the position of the chain (C) is at C=0, when the spoke can break the chain.  The weak link is numbered 0, and follows, with I equaling the total number of links in the chain. The sprocket has n teeth, and after one full revolution of the wheel C=n (after two revolutions Θ =0 but now C=2n).  With these variables, Stephenson draws an incredible connection to modular arithmetic.  While C increases infinitely, the number of links does not, and at C=I the chain returns to C=0.  According to Stephenson’s example, if there are 100 links (I=100) and 135 links have passed, C will equal 35 instead of 135.  To put this into mathematical terms, C = 135 mod 100.  In this way, Turing’s bicycle offers an interesting connection to the way an Enigma machine works.  According to the period of an individual cycle within the machine, the difficulty in cracking a code increases.  This period is similar to how Turing’s bicycle returns to Θ=0 and C=0.  How exactly does this help determine when the chain will fall apart? According to Stephenson, this will happen when a multiple of n is also a multiple of I.  This perspective provided me with a better understanding of modular arithmetic and showed how complex the Enigma machine can be when the period increases.

Image: “Hydroelectric Turbine,” by Guy Mason, Flickr (CC)

A passage that I found especially intriguing in Neal Stephenson’s Cryptonomicon, is when Waterhouse and Turning are on a bike ride in the English countryside. In these few complex mathematical pages, we are taught about modular arithmetic, which helps us understand how the Germans used the Enigma machine during the war. The part of this passage that I grasped, is when they are describing modular arithmetic through the cycles of Turning’s bike, which has one bent spoke on the back wheel. Turning knows that when the link and the spoke come in contact with each other, the chain will break and the bike will be useless. However, he figures out a way around this malfunction as it only occurs when the wheel and the chain happen to coincide.

Stephenson incorporates math when he proceeds to introduce variables.  He lets l stand for the number of links in the chain, n for the number of spokes, and C for the position of the chain. In order to calculate the value of C, you must do modular arithmetic. Stephenson explains the steps by saying “if the chain has a hundred links (l=100) and the total number of links that have moved by is 135, then the value of C is not 135, but 35” (166). The values of C, each time the wheel spins one full rotation, is n mod l, 2n mod l, etc. Ultimately this tells us that the chain will fall off his bike, when some multiple of n happens to match up with a multiple of l as well. This passage is a clever way to describe modular arithmetic, which we have covered in class.