Presentation on theme: "Da Vinci Challenge 2014 - Code Breaking Due to a teacher vocational exchange in 2010/11, nine teams can compete in 2014. Code breaking (the interpretation."— Presentation transcript:
Da Vinci Challenge 2014 - Code Breaking Due to a teacher vocational exchange in 2010/11, nine teams can compete in 2014. Code breaking (the interpretation of SECRET WRITING) is one of the Da Vinci Challenges This presentation aims to describe simple ways to write secretly (encrypt), and offer routes to interpret secret writings (de-encrypt). ………….. You have already read over hidden words in the subtitle of this slide
Code Breaking Algorithm Key & plaintext CIPHERTEXTAlgorithm Key & plaintext CIPHERTEXT Sender Agent Codes & Ciphers To encipher a secret message the Sender uses a formula (Algorithm) to convert Plaintext into CIPHERTEXT, the Agent reverses the process to convert the cipher back to plaintext. Security can be increased by locking the cipher with a Key which is known only to the Sender and his Agent. To break a code, we need to recognise its algorithm, and deduce the key
SECRET WRITING STEGANOGRAPHY (Hidden writing) CRYPTOGRAPHY (Scrambled writing) TRANSPOSITION (Shuffled) SUBSTITUTION (Replaced) ENCODE (Replace Words) ENCIPHER (Replace, Transpose, Substitute Letters) Code Breaking Coding Algorithms We will look at standard methods of constructing and deconstructing each of these algorithms, and at frequency analysis which is a useful tool to make the initial break into a cipher. But beware, encoders like to include twists and false directions in their ciphers. They use keys to obscure the algorithm, and occasionally hide the whole text.
Code Breaking STEGANOGRAPHY (Hidden writing) This demonstrates the weaknesses of Steganography: The agent has to know where to look The agent has to know how to look (the algorithm for DA VINCI was the first letter of every odd numbered word) The delivery is complicated: embedding messages require a huge amount of text, and the ensuing cipher text is often awkward. Messages can be hidden within pictures or within text Remember a hidden message in the sub-title of slide 1? Due to A teacher Vocational exchange In 2010/11, Nine teams Can compete In 2014.
Code Breaking ENCODE (Replace Words) In true codes whole words are replaced by symbols or entirely different words they are only viable if supported by code books (dictionaries) possessed by both the sender and the agent. assassinate = Dcapture = Jblackmail = Pprotect = Z general = king = minister = prince = Immediately = 08 today = 75 tonight = 28 tomorrow = 4 capture the prince tonight encodes as J 28 Cockney rhyming slang uses coded words for nouns e.g. APPLES PLATES MINCE DOG TROUBLE WEASEL
Code Breaking ENCIPHER by TRANSPOSING letters A simple encoding method involves transposing (scrambling) existing letters, using an algorithm known to the agent. Transposition ciphers are very difficult to spot so any in the Da Vinci challenge are likely to be identified as such – unless they are the self evident Railfence or Scytale ciphers, which are described overleaf. Message IHTSIS CINNAE AEDJYS was encoded by breaking the message into groups of 3 letters, reversing each group, and putting it back together. Reversing the process we get: this/is nice/an d/easy/j - Note j is a null character A more common transposition algorithm is to anagram the message, e.g. ATHEIST IS NOSY – is an anagram of this is not easy
Code Breaking ENCIPHER by TRANSPOSING letters Transposition continued Railfence (simple) - imagine a spiked fence with letters arranged as shown b a s i c r a i l f e n c e t r a n p o s i t i o n and written BSCALECTAPSTO.AIRIFNERNOIIN To de-encode, split the code into 2 equal halves and take alternate letters from each half Railfence (multiple groups) yourgrid canbeany sizeyoul ikeforth emessage To encode just read down the columns to get YCSIE OAIKM UNZEE RBEFS GEYOS RAORA INUTG DYLHE To de-encode, take alternate letters from each block. Skytale - demonstration Of course this would be difficult to break if the size & number of blocks did not match the grid unless the agent knows the size already, or the number of letters is a perfect square: e.g. CEEOBADRK CEE OBA DRK
Code Breaking ENCIPHER by SUBSTITUTING symbols Substitution Ciphers – non alphabetic Substitution ciphers where letters are replaced by symbols are the easiest to crack – if the agent knows the symbols, examples are: Pigpen [Masonic] Cipher a pigpen cipher example Baconian [Binary] Cipher To de-encode symbol substitution ciphers like these (and others such as Morse, ASCII, Wingdings & hieroglyphs) simply do a back substitution. AAAAAA£££££NABBAB£$$£$ BAAAAB££££$OABBBA£$$$£ CAAABA£££$£PABBBB£$$$$ DAAABB£££$$QBAAAA$££££ EAABAA££$££RBAAAB$£££$ AAAAB AAAAA AAABA ABBBA ABBAB ABAAA AAAAA ABBAB AAABA ABAAA ABBBB AABBB AABAA BAAAB baconian cipher
Code Breaking ENCIPHER by SUBSTITUTING numbers 1a 6f 11k 16p 21u 2b7g12l17q22v 3c8h13m18r23w 4d9i14n19s24x 5e10j15o20t25y 26z Substitution Ciphers – numeric Substitution ciphers where letters are replaced by numbers are the easiest to crack – if the agent knows the algorithm. Decipher 4 1 12 2 5 1 20 20 9 5 8 9 7 8 19 3 8 15 15 12 plain textdalbeattiehighschool code numbers411225120 958978193815 12 key number24682468246824682468 CODE TEXT6518107526281191417912251110192120 This message would virtually impossible to decode without the agent having the key number. The consecutive code texts are advanced by differing amounts, even double letters have different codes. However reversing the process is simple. dalbeattie high school That was easy, but beware a common trick is to use descending numbers a=26 to z=1. Now see how using a key number (e.g. 2468) complicates the cipher
Code Breaking ENCIPHER by SUBSTITUTING numbers 1a 6f 11k 16p 21u 2b7g12l17q22v 3c8h13m18r23w 4d9i14n19s24x 5e10j15o20t25y 26z Substitution Ciphers – numeric Substitution ciphers where letters are replaced by numbers are the easy to crack – if the agent knows the algorithm. Decipher 4 1 22 9 14 3 9 13 9 12 1 14 da vinci milan That was easy. Now see how using a single key letter (e.g. q) also complicates the cipher plain textqd a vincimilan code numbers1741229143913912114 add code pairsVVVVVVVVVVVV CODE TEXT215233123171222 211315 Reversing the process is also simple, so long as the agent knows the key letter. CODE TEXT215233123171222 211315 Remove leading code 17 41229143913912114 plain textdavincimilan ATBASH
Code Breaking ENCIPHER by SUBSTITUTING letters Substitution Ciphers – monoalphabetic Monoalphabetic substitution ciphers replace each letter with another letter in the same alphabet, the simplest of these ciphers is the: Atbash Cipher In this cipher the first letter of the alphabet is replaced by the last [A = Z], the second letter by the penultimate [B = Y] and so on, until we get: ABCDEFGHIJKLM ZYXWVUTSRQPON This cipher was first used in hebrew and its name comes from the hebrew equivalent of A=Z, B=Y which is aleph=tav, beth=shin An interesting quirk of the Atbash cipher is that in english some words encipher into other words, e.g. HOLD IRK ZOO TILT - which deciphers as slow rip all grog
Code Breaking ENCIPHER by SUBSTITUTING letters Substitution Ciphers – monoalphabetic Substitution ciphers where letters are replaced by other letters can be the most difficult to crack – unless the agent has the key and algorithm e.g. Caesar Cipher Julius Caesar frequently wrote coded state messages, a frequent Caesar code replaced each letter with one 3 places further down the alphabet thus PHQ IUHHOB EHOLHYH WKDW ZKLFK WKHB GHVLUH is the cipher for men freely believe that which they desire.
Code Breaking ENCIPHER by SUBSTITUTING letters Substitution Ciphers – monoalphabetic with key Caesar Cipher with key We saw that using the basic Caesar cipher men freely believe that which they desire we get PHQ IUHHOB EHOLHYH WKDW ZKLFK WKHB GHVLUH But the cipher is made more complex if a key word (e.g. Julius Caesar) is used to displace the letters: Plainabcdefghijklmnopqrstuvwxyz CIPHERJULISCAERTVWXYZBDFGHKMNOPQ In this case we get XSY CFSSWP USWRSMS HEJH NERLE HESP ISGRFS De-encription requires the cipher alphabet to be rebuilt using the algorithm Start with the key word(s) without repeated letters Fill in the remaining letters starting with the next sequential unused letter
Code Breaking ENCIPHER by SUBSTITUTING letters Vigenère Cipher (Polyalphabetic) Blaise de Vigenère devised a way of using a series of cipher alphabets and key word(s). Thus using key words Da Vinci for his quotation “ art is never finished only abandoned” we get DRO QF PMYEM NVOQVHZL BOTB AWIAFWPEZ plain textartisneverfinis key wordDAVINCIDAVINCID CODE TEXTDROQFPMYEMNVOQV plain texthedonly abandoned key wordAVINCIDAVINCIDAV CODE TEXTHZLBOTBAWIAFWPEZ The strength of the Vigenère cipher is that repeat letters only have the same code infrequently, here d is coded L, F & Z Note : the Caesar cipher is row 3! Plainabcdefghijklmnopqrstuvwxyz 1BCDEFGHIJKLMNOPQRSTUVWXYZA 2CDEFGHIJKLMNOPQRSTUVWXYZAB 3DEFGHIJKLMNOPQRSTUVWXYZABC 4EFGHIJKLMNOPQRSTUVWXYZABCD 5FGHIJKLMNOPQRSTUVWXYZABCDE 6GHIJKLMNOPQRSTUVWXYZABCDEF 7HIJKLMNOPQRSTUVWXYZABCDEFG 8IJKLMNOPQRSTUVWXYZABCDEFGH 9JKLMNOPQRSTUVWXYZABCDEFGHI 10KLMNOPQRSTUVWXYZABCDEFGHIJ 11LMNOPQRSTUVWXYZABCDEFGHIJK 12MNOPQRSTUVWXYZABCDEFGHIJKL 13NOPQRSTUVWXYZABCDEFGHIJKLM 14OPQRSTUVWXYZABCDEFGHIJKLMN 15PQRSTUVWXYZABCDEFGHIJKLMNO 16QRSTUVWXYZABCDEFGHIJKLMNOP 17RSTUVWXYZABCDEFGHIJKLMNOPQ 18STUVWXYZABCDEFGHIJKLMNOPQR 19TUVWXYZABCDEFGHIJKLMNOPQRS 20UVWXYZABCDEFGHIJKLMNOPQRST 21VWXYZABCDEFGHIJKLMNOPQRSTU 22WXYZABCDEFGHIJKLMNOPQRSTUV 23XYZABCDEFGHIJKLMNOPQRSTUVW 24YZABCDEFGHIJKLMNOPQRSTUVWX 25ZABCDEFGHIJKLMNOPQRSTUVWXY 26ABCDEFGHIJKLMNOPQRSTUVWXYZ
Code Breaking ENCIPHER by SUBSTITUTING letters Eagles, Tits and Ospreys If all else fails a text cipher can be deciphered using letter and word frequency, so long as it is relatively long (100+ letters) e127 d43 p19 t91l40b15 a82u28v10 o75c28k8 i70m24x2 n67w24j2 s63f22q1 h61y20z1 r60 g20 Letter frequency/1000 J Q K Z X all <1% Eagles, Tits And Ospreys Inhabit North Scotland – gives top 60% in order. One and 2 letters only 2 one letter words 7 common double repeats in order The = commonest 3 letter word abeoranss iasongoee ofatdonott tosoifusff inwemeamll ithemymm isbyupoo Other clues Very few words are without a vowel (e.g. fly wry) Q is always followed by U H frequently goes before E (e.g. the, then, they) but rarely after E
Code Breaking ARE YOU AGENT MATERIAL? The preceding slides ran very quickly through the ciphers which I believe you are most likely to meet in the Da Vinci challenge, although I have yet to see a question involving a key locked code, or a polyalphabetic question To prepare for the challenge it will be necessary to run through the slides a few at a time to be able to recognise the different ways to encipher and de-encipher a message. As well as interest in Code Breaking an agent needs to be: LiterateNumerateAccurate and comfortable with EtymologyHeuristicsQuotations So Mr Bond - here’s your first message from M: UZFQDQEFQP?OAZFMOFKAGDFQMYOAMOT
Code Breaking Decoding M’s message The previous slide contained the code: ………….. how can we decipher it? It does not contain numbers, pigpen shapes, hieroglyphs etc so it is probably an alphabetic code ? is strange but it could be a null character or just punctuation, ignore for now So is it a transposition code or a substitution code? ….. a transposition code only uses letters in the original message – there are too many Qs for this to be a transposition message (remember Q is one of the <1% letters) Look at the letter distribution ….. There are 4 Qs and 5 Fs (so they are likely to be e, t, a or o) Does the ? make it a railfence code? ….. No it is not in the middle and taking alternate letters from each group (UOZA etc) does not make sense Does it use multiple alphabets (i.e. Vigenere) …. Not likely, no key word has been given That makes it monoalphabetic (i.e. Caesar), but what is the advancement? … you can find that by using the Vigenere square and finding a row where Q & F are decoded as 2 of e,t,a,or o. Or look at the question ……`a message from M’ hints that the advance is 12 (i.e. M=a, Q=e and F=t). We now have UZteDeEteP?OAZtaOtKAGDteaYOAaOT ….. You can now decode the rest of the message using row 12 UZFQDQEFQP?OAZFMOFKAGDFQMYOAMOT
Code Breaking Further Information Examples of codes and codebreaking online at http://www.counton.org/explorer/codebreaking/ http://www.counton.org/explorer/codebreaking/ Books Or have your school’s Da Vinci facilitator contact Geoff Allison via Sue Bain, Piers Butler or Lesley Sloan