Tudor Grange Academy
Homework option
• The German military used the Enigma cipher machine during WW2 to keep their communications secret. The machine was available commercially during the 1920s, but the military potential of the device was quickly realised and the German army, navy and air force all used a more developed model of the machine to encipher their messages believing that it would make these communications impenetrable to the enemy. • The Enigma machine is an electro-mechanical device that relies on a series of rotating 'wheels' or ‘rotors’ to scramble plaintext messages into incoherent ciphertext. The machine's variable elements can be set in many billions of combinations, and each one will generate a completely different ciphertext message. If you know how the machine has been set up, you can type the ciphertext back in and it will unscramble the message. If you don't know the Enigma setting, the message remains indecipherable. • The German authorities believed in the absolute security of the Enigma. However, with the help of Polish mathematicians who had managed to acquire a machine prior to the outbreak of WW2, British code breakers stationed at Bletchley Park managed to exploit weaknesses in the machine and how it was used and were able to crack the Enigma code. • Breaking the Enigma ciphers gave the Allies a key advantage, which, according to historians, shortened the war by two years thus saving many lives.
Tudor Grange Academy
The original Enigma story
• You are a secret agent at MI6 and you are working on the top secret Enigma 2 project • You have been asked to write the code for a program which will “decode” the hidden message in a text file and display it • The program must be written in Python! • Question: what skills do you think you will need for this task?
Tudor Grange Academy
The scenario
• The program has to read an encrypted file, retrieve the hidden message and display it • The hidden message is made up of characters which are at set intervals in the text in the file • The last character in the file is the “enumerator” • The “enumerator” is a number which represents the intervals, i.e. the number of characters between each character in the hidden message • For example, if the hidden message is as follows:
• Asdfhexdfesdvflasdflfddsos5 • The hidden message is “hello” • Every character in the hidden message is at intervals of 5 characters – the last character tells us the interval is 5 • The enumerator you set can be different
Tudor Grange Academy
The requirements
1. Set up the text file with the hidden message (you can write this yourself – any message as long as it is appropriate. You might want to start with a basic one word message to keep things simple). Use Word and save it as a text file. 2. Think about the problem. You do not have to produce a flowchart for this task although you can if you want – you may find it will help you decompose the problem! 3. Write the solution. Good luck! The future of our national security lies in your hands.
Tudor Grange Academy
Getting started
• If you do manage to complete this challenge…well done! • It would be fairly easy for someone to decipher the message at the moment. How could you improve the program so that it would be more difficult to decipher the message?
Tudor Grange Academy
Extension