300 likes | 1.05k Views
The Mathematics of Codes-Day 2. Michael A. Karls Ball State University June 22-24, 2005. Cryptography Throughout History. Since the development of the Caesar cipher, many schemes for encrypting messages and breaking encrypted messages have been developed.
E N D
The Mathematics of Codes-Day 2 Michael A. Karls Ball State University June 22-24, 2005
Cryptography Throughout History • Since the development of the Caesar cipher, many schemes for encrypting messages and breaking encrypted messages have been developed. • We now look at some famous cryptographic methods and ways they can be broken!
Breaking Monoalphabetic Substitution Ciphers • Ciphers such as the Caesar cipher and affine cipher can be broken using the technique developed by Arab cryptanalysts over 1000 years ago—frequency analysis! • For example, frequency analysis can be used on Homework 1 problem # 6! • Handout Frequency of English Letters Table.
Breaking Monoalphabetic Substitution Ciphers (cont.) • Ciphertext: HEXFX CG ICHHIX WAJQH HEPH HEX BFAQIXT AZ BFAHXVHCYS PYW GXVJFCYS VATTJYCVPHCAYG LCII VAYHCYJX HA SFAL WJFCYS HEX VATCYS NXPFG YAH AYIN CY CHG HFPWCHCAYPI TCICHPFN PYW BAICHCVPI FAIXG QJH PIGA CY HEX BJQICV PYW VATTXFVCPI WATPCYG. • Frequency analysis shows that the most commonly occurring letters in the ciphertext are C, H, A, Y, I, and X (Handout.) • Based on relative frequency of letters in a piece of English text and position of letters in three-letter words, we guess that ciphertext “HEX” plaintext “the”. • Ciphertext becomes: theFe CG ICttIe WAJQt thPt the BFAQIeT AZ BFAteVtCYS PYW GeVJFCYS VATTJYCVPtCAYG LCII VAYtCYJe tA SFAL WJFCYS the VATCYS NePFG YAt AYIN CY CtG tFPWCtCAYPI TCICtPFN PYW BAICtCVPI FAIeG QJt PIGA CY the BJQICV PYW VATTeFVCPI WATPCYG."
Breaking Monoalphabetic Substitution Ciphers (cont.) • New encryption methods needed to be invented to overcome this flaw in monoalphabetic ciphers. • Techniques developed to strengthen these ciphers include: • Misspell words in plaintext message. • Add in dummy symbols called nulls. For example, assign 00 – 25 to a – z and add in symbols 26 – 99. • Add in code words or symbols along with a cipher alphabet. An example of this is Mary Queen of Scots’ nomenclature—it also had nulls (see p. 38 of The Code Book.) • All of these techniques can still be broken using frequency analysis!
Homophonic Substitution Ciphers • Frequency analysis of a ciphertext works because of the fact that each letter of the plaintext is replaced with only one ciphertext letter! • For example, if we have plain e X, t B, and h W, then since e, t, and h, appear approximately 13%, 9%, and 6% of the time, respectively, we’d expect to see X, B, and W in the ciphertext 13%, 9%, and 6% of the time, respectively! • Furthermore, every occurrence of “the” in the plaintext would be encrypted as “BWX”. • One way to get around this problem is to assign more than one symbol to a given plaintext symbol!
Homophonic Substitution Ciphers (cont.) • To take frequency analysis out of the picture, we use the following rules: • In order to make deciphering unique, the sets of symbols belonging to plaintext letters must be disjoint, i.e. have no common elements. • The number of ciphertext symbols assigned to a plaintext letter is determined by the frequency of the letter, i.e. relative frequency of the letter in a given language!
Homophonic Substitution Ciphers (cont.) • Example 1: Here is an example of a homophonic substitution cipher. Use it to encrypt the message “the cat in the hat”. • Randomly choose a ciphertext letter for each plaintext letter—use pieces of paper numbered 1 – 12, 1 – 6, etc. (Handout.)
Homophonic Substitution Ciphers (cont.) • Since we are choosing each ciphertext symbol randomly, any symbol has the same chance of occurring. • This means frequency analysis cannot be used to decipher messages encrypted with a homophonic substitution cipher! • “Homophonic” comes from Greek “homos” (same) and “phonos” (sound). For the above example, all two-digit numbers that stand for a letter such as “a” represent the same sound.
Homophonic Substitution Ciphers (cont.) • Even though frequency analysis can’t be used to break a homophonic cipher, we can use digraphs and trigraphs to help break these ciphers! • Digraphs and trigraphs are pairs or triples of letters that occur in a given language such as English (Handout.)
Homophonic Substitution Ciphers (cont.) • In the example above, “of” can only be encrypted in 7 x 2=14 different ways. • Also, there are only 6 choices for ciphertext symbols that stand for “h”, so if we know the ciphertext symbols for “t”, we have a good chance of figuring out what stands for “h”, as “h” often follows “t”.
Vigenère Cipher • Instead of using just one alphabet to encipher a message, methods have been developed that use more than one alphabet. • Such ciphers are called polyalphabetic substitution ciphers. • The most famous polyalphabetic cipher is the Vigenère Cipher. • It was published in 1586 (the same year as Mary Queen of Scots’ death). • Developed by the French diplomat Blaise de Vigenère.
Vigenère Cipher (cont.) • As with many great ideas, Vigenère was not the first to discover this method! • Leone Battista Alberti (1470, cipher wheel) • Johannes Trithemius (1462-1516) • Giovanni Della Porta (1535-1615) • Vigenère took their ideas and combined them to produce a new cipher!
Vigenère Cipher (cont.) • Here is how the Vigenère Cipher works: • Choose a keyword and make a Vigenère Square (Handout). (Note that this square is just all 26 possible additive ciphers written in rows!) • Write the keyword above the plaintext letters. For example, choose VENUS as the keyword and “polyalphabetic” as the plaintext. • To encipher, the letter of the keyword above a plaintext letter determines the row (i.e. alphabet) to choose. The plaintext letter determines the column to choose.
Vigenère Cipher (cont.) • Example 2: To encrypt the “p” in “polyalphabetic”, use the row starting with “V” and column below “p”. • Thus, pK. • Encipher “polyalphabetic”, using keyword VENUS. • Plaintext: polyalphabetic • Ciphertext: KSYSSGTUUTZXV W
Vigenère Cipher (cont.) • In example 2, we see that • p K, T • a S, U. • Also, • o, a, y S • p, b T • h, a U • Each plaintext letter can map to more than one ciphertext letter! • Also more than one plaintext letter can map to the same ciphertext letter! • Ciphertext letters tend to be “equally” distributed, so Vigenère ciphers are protected from frequency analysis.
Vigenère Cipher (cont.) • Although developed in 1586, the Vigenère cipher wasn’t widely used until 200 years later. • Other ciphers were developed that were easier to use and more secure than monoalphabetic substitution ciphers, such as homophonic ciphers. • Military organizations needed a system that was faster to implement than Vigenère – 100’s of messages sent each day! • Events that led to the adoption of Vigenère cipher • 1700’s: Countries set up “Black Chambers” that intercepted and decrypted mail sent to and from other countries—cryptographers needed a more secure system. • 1800’s: Telegraph invented—need for a secure form of communication arose, as telegraph operators could read what was being sent.
Vigenère Cipher (cont.) • The Vigenère cipher was cracked in 1854 by Charles Babbage, an English inventor. • In 1823, Babbage designed the first computer, known as Difference Engine # 1. • 25,000 part steam-powered calculating device. • After spending 17,450 pounds, he abandoned the project and decided to build Difference Engine # 2. This second machine, which was never built, provided the blueprint for the modern computer! • A dentist named John Hall Brock Thwaites claimed he had invented a new cipher (it was really the Vigenère cipher). • Babbage told Thwaite his cipher was already known. • Thwaite challenged Babbage to break the cipher, so Babbage figured out a method to crack the cipher, based on the distance between repeated groups of letters in the ciphertext. • The scheme Babbage developed for cracking the Vigenère cipher is known as the Kasiski Test, as Babbage never published his result—it was first published by Wilhelm Kasiski in 1863.
ADFGVX Cipher • Developed by the Germans in WWI—introduced in March 1918. • Used to encrypt radio messages sent by military. • Broken by the French in June 1918—Georges Painvin (he lost 15 kg~33 lb cracking cipher). • ADFGVX cipher relies on a mixture of substitution and transposition.
Put alphabet and numbers 0 – 9 into a 6 x 6 grid, with row and column headings ADFGVX. Find the plain letter in grid. For example, Plaintext: attack at 10 pm Ciphertext: DV DD DD DV FG FD DV DD AV XG AD GX. Choose a keyword, such as MONEY. ADFGVX Cipher (cont.)
Write the encrypted message DV DD DD DV FG FD DV DD AV XG AD GX in rows below the keyword. Rearrange the columns by putting the keyword letters in alphabetical order. Finally, read down the columns in order to get the ciphertext. DFVXX DDFDA DVDVG VDDAD DGDG ADFGVX Cipher (cont.)
ADFGVX Cipher (cont.) • Cipher is sent in Morse code. • ADFGVX chosen as these letters are distinct in Morse code (see p. 62 in our textbook)—less likelihood of errors in transmission.
Enigma Machine Cipher • Invented by Germans Arthur Scherbius and Richard Ritter in 1918. • Scherbius wanted to replace pencil and paper ciphers with a machine. • Others who invented similar devices: • Alexander Koch (1919, Netherlands)—failed to make any money, sold patent rights in 1927. • Arvid Damm (Norway)—took out patent, but died in 1927 before he could find a market for device. • Edward Herbern (mid 1920’s, America)—spent $380,000 to build factory, sold only 12 machines at a total of $1200—taken to court by shareholders!
Enigma Machine Cipher (cont.) • Scherbius tried to sell Enigma machines to businesses and diplomats, but the machines were too expensive (~$30,000 in today’s dollars). • German military was the main user of the Enigma machines. • At first, the German military didn’t see a need for the Enigma, as they didn’t know their ciphers were compromised. • In 1923, two British documents written by Winston Churchill and the Royal Navy were released—they stated that interception and analysis of German ciphers helped the allies win WWI.
Enigma Machine Cipher (cont.) • Main elements of the Enigma (see p. 139): • Three rotors with 26 letters that are interchangeable. • Keyboard to type letters of message to be encrypted. • Lamp board with lights to indicate the cipher letters. • Plug board with 6 cables to connect 6 pairs of letters. • Each time a key is pressed, the rotors move (like an odometer), changing the enciphering alphabet for each letter. • See Chapter 3 and 4 in The Code Book!
Enigma Machine Cipher (cont.) • The key to the Enigma was the rotor positions, initial rotor settings and plugboard settings. • The Fundamental Principle of Counting can be used to find the number of possible keys: • # choices for rotor 1: 3 • # choices for rotor 2: 2 • # choices for rotor 3: 1 • # rotor positions: 3 x 2 x 1 = 6 • # settings for rotor 1: 26 • # settings for rotor 2: 26 • # settings for rotor 3: 26 • # rotor settings: 26 x 26 x 26 = 17,576 • # plugboard settings: 100,391,791,500 (see why on my web page) • Total number of keys: 6 x 17,576 x 100,391,791,500 = 10,586,916,764,424,000
Enigma Machine Cipher (cont.) • During WWII, the Enigma was used by the Germans to encrypt radio messages sent by the military. • Chapter 4 in The Code Book looks at how a team of cryptographers (including mathematicians) at Bletchley Park in England were able to crack the Enigma cipher!
Navajo Code Talkers • In WWII, the Americans and British developed their own versions of cipher machines similar to the Enigma (SIGABA and Typex). • During the jungle campaign in the Pacific, a major flaw of these machines was revealed—they are too slow to use during a heated battle! • In 1942, a solution was suggested by Philip Johnston who had grown up on the Navajo reservation in Arizona. • Johnston’s idea was to have a people fluent in a Native American language such as Navajo assigned as radio operators with combat groups in the Pacific. • Navajo was selected as the language for three reasons: • There needed to be enough men in the tribe who were fluent in English and literate (four possible tribes met this criterion). • The Navajo were the only tribe in the US not infiltrated with German students in the previous 20 years, so the Germans didn’t know Navajo. • Navajo is unintelligible to all other tribes and all other people, except for the ~28 non-Navajo people in the US who knew Navajo!
Navajo Code Talkers (cont.) • The scheme used by the Navajo “code talkers”: • Codewords for planes, ships, and other common military terms. For example, Battleship Whale Lo-tso. • An alphabet made up of words for animal names that start with the alphabet letter. For example, A Ant Wol-la-chee. • Less common words were spelled out. (See p. 199 in our textbook for the code for Guadacanal Island.) • For more about the Code Talkers, see Chapter 5 of The Code Book!
Navajo Code Talkers (cont.) • “Flaws” in the initial version of the code: • Initially there were 274 words. • Time consuming to spell out long words. • Frequency analysis could be used by the Japanese to decipher words that were spelled out, for example E Elk Dzeh occurred most often. • Spelling out words such as names of islands could give away parts of the code. • Solution—use homophones for letters such as e that occur more frequently! Two extra words were introduced for e, t, a, o, I, n and one extra word for s, h, r, d, l, u. • Also, 234 words were added to decrease the number of words needed to be spelled out. • The Code Talkers had to memorize all of the code words! • Navajo Code Talker Dictionary: http://www.history.navy.mil/faqs/faq61-4.htm