Evaluation of Various Decryption Techniques to Decipher a Polyalphabetic Substitution Cipher
Total Page:16
File Type:pdf, Size:1020Kb
“Breaking and Entering”: Evaluation of Various Decryption Techniques to Decipher a Polyalphabetic Substitution Cipher. A dissertation submitted in partial fulfilment of the requirements for the degree of Bachelor of Science (Honours) in Computing by Ryan J. Brown Department of Computing & Information Systems Cardiff School of Management Cardiff Metropolitan University April 2017 i Declaration I hereby declare that this dissertation entitled “Breaking and Entering”: Evaluation of Various Decryption Techniques to Decipher a Polyalphabetic Substitution Cipher is entirely my own work, and it has never been submitted nor is it currently being submitted for any other degree. Candidate: Ryan Brown Signature: Date: 18/04/2017 Supervisor: Dr Chaminda Hewage/Dr Ambikesh Jayal Signature: Date: 18/04/2017 ii Abstract The dissertation research is based upon both cryptology (the study of cryptosystems in encryption and decryption) and analysing machine learning algorithms. Combining these two studies helped in both understanding cryptosystems as well as testing the performances of the different machine learning algorithms. The purpose is to use the machine learning algorithms to decrypt a polyalphabetic cipher by using a cipher-text only attack and exploiting the key used. This dissertation topic mainly looked at the effectiveness of the different algorithms performances whilst decrypting a polyalphabetic cipher. This encouraged some useful data that produced reliable information based on the algorithm, including: the functionality; the complexity of each; and, the ability to find better results of keys. iii Acknowledgments I would like to thank my family and friends for supporting me throughout University. I would especially like to thank my parents and brother for making many cups of tea during my studies. Without this I may have not been as motivated. A big thank you to my supervisor Dr Chaminda Hewage/Dr. Ambikesh Jayal for the continuous help and support throughout the dissertation. Also, I would like to thank Dr Ambikesh Jayal for the initial input and ideas. iv Table of Contents Abstract ........................................................................................................................................... iii Acknowledgments........................................................................................................................... iv Table of Contents ............................................................................................................................. v List of Tables .................................................................................................................................. vii List of Figures ................................................................................................................................ viii 1. Introduction ............................................................................................................................ 1 1.1. Purpose and Structure ..................................................................................................... 1 1.2. Research Question ........................................................................................................... 2 2. Literature Review .................................................................................................................... 2 2.1. History of Cryptology ....................................................................................................... 2 2.2. Cryptology ........................................................................................................................ 6 2.2.1. Cryptography ............................................................................................................ 7 2.2.1.1. Substitution Cipher................................................................................................ 7 2.2.1.1.1. Simple Substitution/Monoalphabetic Ciphers .................................................. 8 2.2.1.1.2. Polyalphabetic Cipher ........................................................................................ 9 2.2.1.2. Transposition Cipher ........................................................................................... 11 2.2.2. Cryptanalysis ........................................................................................................... 11 2.2.2.1. Cryptanalysis Attacks .......................................................................................... 11 2.3. Machine Learning Algorithms ........................................................................................ 14 2.3.1. Hill Climbing Algorithm ........................................................................................... 15 2.3.2. Genetic Algorithm ................................................................................................... 16 2.3.3. Simulated Annealing ............................................................................................... 17 2.4. The Big O Notation ......................................................................................................... 18 3. Methodology ......................................................................................................................... 19 3.1. Approach ........................................................................................................................ 19 3.2. Strategy and Research Design ........................................................................................ 19 3.2.1. Encryption ............................................................................................................... 20 3.2.2. Decryption ............................................................................................................... 22 3.2.3. Scoring ..................................................................................................................... 23 3.2.4. Machine Learning methods .................................................................................... 25 3.2.4.1. ‘Random Hill Climbing’ ........................................................................................ 26 3.2.4.2. ‘Genetic Algorithm’ ............................................................................................. 27 v 3.2.4.3. ‘Random Optimisation’ ....................................................................................... 28 3.2.4.4. ‘Simulated Annealing’ ......................................................................................... 28 3.3. Data Collection and Analysis Methods .......................................................................... 29 3.4. Limitations ...................................................................................................................... 30 4. Evaluation and Results .......................................................................................................... 31 4.1. Random Hill Climbing ..................................................................................................... 31 4.2. Genetic Algorithm .......................................................................................................... 35 4.3. Random Optimisation .................................................................................................... 39 4.4. Simulated Annealing ...................................................................................................... 42 4.5. Evaluation ....................................................................................................................... 46 5. Conclusion ............................................................................................................................. 48 References .................................................................................................................................... 50 Appendices .................................................................................................................................... 54 Appendix 1 – 217 words for encryption from ‘Winston Churchill to Franklin D. Roosevelt’ message November 23, 1940. (National Churchill Museum, no date) .................................... 54 Appendix 2 – Encrypting the message by ‘Winston Churchill’ in Appendix 1. ......................... 56 Appendix 3 – JUnit Testing the encrypted message ................................................................. 59 Appendix 4 – Decrypting the polyalphabetic cipher. ............................................................... 61 Appendix 5 – Fitness Scoring of text using Quad grams (Practical Cryptography, 2009) ........ 62 Appendix 6 – Machine Learning Algorithms implementation .................................................. 64 Appendix 7 – Testing performance of algorithms ................................................................... 71 Appendix 8 – Ethics form (2016D0099) .................................................................................... 75 vi List of Tables Table 1 - Polyalphabetic cipher using modern tablu recta in figure 3 .......................................... 10 Table 2 - Random Hill Climbing data ............................................................................................ 31 Table 3 - Random Hill Climbing graphs ......................................................................................... 33 Table 4 - Genetic Algorithm data .................................................................................................