6. Introduction to Cryptanalysis#

Now that we’ve covered data types, loops, functions, and modules, we’re well equipped to leverage the power of Python to start analyzing ciphertext messages for patterns that will help us determine the keys to a cipher or reveal their plaintext messages even if we don’t have the key. This practice is called cryptanalysis, or conversationally cracking a cipher.

Historically cryptanalysis was done by hand, often in large teams to speed up the process. A notable example was in Europe during the 1700s, when major cities would intercept mail looking for enciphered messages. From Wikipedia:

By the 1700s, cryptanalysis was becoming industrialized, with teams of government cryptanalysts working together to crack the most complex monoalphabetic ciphers. Each European power had its own so called black chamber, a nerve centre for deciphering messages and gathering intelligence. The most celebrated, disciplined and efficient was the Geheime Kabinettskanzlei in Vienna. It operated according to a strict timetable, because it was vital that its activities should not interrupt the smooth running of the postal service. Letters which were supposed to be delivered to embassies in Vienna were first routed via the black chamber, arriving at 7 am. Secretaries melted seals, and a team of stenographers worked in parallel to make copies of the letters. Within three hours the letters had been resealed and returned to the central post office to be delivered to their intended destination. As well as supplying the emperors of Austria with vital intelligence, the Viennese black chamber sold the information it harvested to other European powers. In 1774, for example, an arrangement was made with Abbot Georgel, the secretary in the French embassy, who had access to a biweekly package on information for 1,000 ducats.

The need to break secret ciphers often drove innovation in technology to increase efficiency. During World War II, the Allies built the first primitive electro-mechanical computers, known as Bombes for their ticking noises, which would attempt to determine the keys for the German Enigma machine. This innovation would lead the way to the programmable computers we have today.