Assessing the Viability of the Rotor Cipher in the Modern World
Total Page:16
File Type:pdf, Size:1020Kb
Assessing the Viability of the Rotor Cipher in the Modern World by Jordan Zink Gahanna Lincoln High School 140 S Hamilton Road Gahanna, Ohio 43230 [email protected] (614) 307-3669 Prepared for GLHS Science Academy Symposium February 5, 2010 2 ASSESSING THE VIABILITY OF THE ROTOR CIPHER IN THE MODERN WORLD Jordan Zink Gahanna Lincoln High School, 140 S Hamilton Road, Gahanna, Ohio 43230 The purpose of this project is to determine the viability of the rotor cipher in the modern world of computer cryptography. This project consists of two phases: modifying the cipher to increase its security and running a simulation to assess the effectiveness of a brute force attack. While many modifications were made, one modification involved shortening the plaintext before encryption by removing unnecessary letters and replacing words with symbols. An experiment was run to determine the level of shortening that would not distort meaning. 20 subjects participated and it was found that a conservative level of shortening did not significantly distort meaning, while a liberal level of shortening did distortion meaning slightly. It was also found that there was no significant difference between youth and adult subjects, or between subjects familiar and unfamiliar with texting and online lingo. To simulate a brute force attack, a computer program was written in Visual Basic. Initial testing found household computers could not break a message encrypted with 3 or more rotors. A regression equation was found to predict the key search speed based on plaintext length (R2 = 0.9988). Also, the equation t = 2562n/s was created to showed the relation of time to run a brute force attack to the number of rotors and the key search speed. An investigation into the parts of a computer that make a brute force attack run faster was also conducted. It was found that processors with high l-2 cache, voltage, and front side bus speed were the fastest, and RAM had little to no effect on time. It was concluded that the rotor cipher is a viable cipher in the modern world. Also, plaintext shortening can be applied with most ciphers, which can boost security. 3 Table of Contents I. Introduction…………………………………………………………………………….……….4 II. Review of Literature………………………………………………………………...…...…….5 III. Methods………………………………………………………………………………...…….18 IV. Results & Analysis…………………………………………………………………….…….27 V. Conclusion………………………………………………………………………………...….34 VI. Acknowledgments………………………………………………………………………..….36 VII. Works Cited……………………………………………………………………...………….37 VIII. Appendix………………………………………………………………………………...…40 4 Introduction Cryptography is a field that often goes unappreciated. Many people do not know what a cryptologist even does. However, cryptography is one of the most important fields in computer science. Although it often goes unseen, it is used by everyone daily. The simple concept of keeping information secret from prying eyes is, in reality, a complex science rooted deep in logic and mathematics. While it may be considered an evil, it is a necessary evil for the world today. Within cryptography there lie many different ciphers, or methods of encrypting and decrypting data. The point of this project is to research one of these ciphers called a rotor cipher. This cipher was used by the Germans in WWII and required a large effort by the Allies to break, including the creation of the first computer. However, in the move to computers and modern ciphers after the war, the rotor cipher was left behind and became merely cryptographic history. This project hopes to assess whether, through implementation on a computer, the rotor cipher still presents a viable secure cipher. The project consists of two phases; modifications to the cipher to increase security and a simulation to test the effectiveness of a brute force attack on the cipher. 5 Review of Literature Introduction to Cryptography The first recorded instance of concealing information is in Roman philosopher Herodotus’s The Histories, where he chronicles the conflicts of the fifth century BC between Persia and Greece. He mentions that a Greek in Persia hid a message on a piece of wood by covering it with wax revealing Persian military actions. The message was not discovered as it left Persia and ended up saving Greece from a Persian assault. This event is an example of steganography, or hiding messages through hiding the existence of a message. While effective when not discovered, steganography provides no security if the message itself is discovered (Singh, 1999). The weaknesses of stegaography led to the creation of cryptography. Cryptography hides information not by concealing the existence of a message, but by making the information unreadable except by those parties meant to read the message. In order to hide a message, a sender would take the plaintext (information to be encrypted) and what is called a key and combined them through an algorithm to produce a ciphertext (the encrypted message to be sent). The algorithm is the basic instructions on how to encipher a message, while the key is a further set of instructions which is specific to each message. Once the receiver gets the message, he or she will use the algorithm along with the same key to decrypt the message, revealing the original plaintext (Signh, 1999). The first ciphers consisted of two categories: transposition and substitution. Transposition revolves around re-arranging the order of the letters in a word. For example, the word “example” would become “xplamee”. The weakness of transposition is for the algorithm to be more secure, it must become very complex. Simple algorithms, like writing the message 6 backwards, provide little security. The second method, substitution, involves replacing certain letters with other letters. The most famous of these ciphers was the Caesar cipher. The cipher involved replacing a letter with the letter a certain number of places in front of it in the alphabet. So if the shift was one, “example” would become “fybnqmf”, and if the shift was two, “example” would become “gzcorg” (Singh, 1999). The weakness of the simple substitution cipher led to the creation of a critical part of cryptography: cryptanalysis. Cryptanalysis, or codebreaking, is the study of deriving the plaintext from a ciphertext without knowing the key. The first reference of cryptanalysis is in the works of al-Kindī, an Arab philosopher. He suggested counting the number of occurrences of a letter in a ciphertext and comparing that to the normal distribution of letters in that language. This method, known as frequency analysis, shows the weakness of substitution ciphers, since they have the same letter distribution in the ciphertext and the plaintext. Al-Kindī’s work also showed that cryptographic ciphers could be broken by analyzing the ciphertext (Singh, 1999). Overtime, the simple ciphers of the early days of cryptography were replaced by newer, more complex ones. One of the most famous was Le Chiffre Indéchiffrable (French for “the unbreakable cipher”), or the Vigenère Cipher. Substitution ciphers up to the Renaissance were monoalphabetic ciphers, meaning a single substitution alphabet was used for the entire message. While these ciphers allowed for easy frequency analysis, the lack of common knowledge in such matters kept these ciphers secure. But with the Renaissance came a need for more secure encryptions. In the mid-1500s, a French diplomat named Blaise de Vigenère developed the Le Chiffre Indéchiffrable (French for “the unbreakable cipher”), or the Vigenère Cipher. This cipher was a polyalphabetic cipher, meaning it used multiple substitution alphabets to encrypt a single message. In the cipher, the plaintext would be encrypted using one of 26 different 7 substitution alphabets selected by the key (which was usually a keyword repeated for the length of the message). Using multiple substitution alphabets made simple frequency analysis useless since every letter did not necessary encrypt to the same letter for the length of the message. This cipher remained secure until it was broken by Charles Babbage in the 19th century, who took advantage of the repeating keyword to perform complex frequency analysis. (Pincock, 2006). During WWI, many new ciphers were created to keep military traffic secret. However, they were all built on out-dated thoughts and ideas, allowing cryptanalyst to break most ciphers. Countries began looking for more powerful ciphers, and cipher machines presented an answer. A cipher machine uses a mechanism to perform encryption rather than a person using pencil, paper, and look-up tables. First cipher machines were disks which simply made it easier to perform the Vigenère Cipher. However, cipher machines would revolutionize cryptography in 1918 (Singh, 1999). The Enigma Machine Arthur Scherbius, a German inventor with an understanding in electrical engineering, invented the Enigma machine in 1918. The machine consisted of a keyboard, a series of scrambling mechanisms, and a lamp board. After pressing a key, an electrical current traveled down a wire to the scrambling mechanism, which consisted of a series of rotors (the exact number varies based on Enigma model; the standard is three) and a reflector. Each rotor had 26 contacts, each corresponding to a letter of the alphabet. Inside the rotor was a jumble of wires which connected each contact on one side with a random contact on the other side. The electrical current would pass through these rotors, changing position along the way, until it reached the reflector. The reflector paired together random pairs of contacts (which can be thought of as letters). So if the current entered the “A” contact, it would leave through the “G” 8 contact, moving in the opposite direction, and vice versa (current entering “G” would leave as “A”). After passing through the reflector, the current traveled back through the rotors and again change positions. Once back to the side of the rotors where it began, it traveled to a lamp board which illuminated a small light bulb under the letter corresponding to the position the current left the last rotor in (Singh, 1999).