Analysis of the Zodiac 340-Cipher
Total Page:16
File Type:pdf, Size:1020Kb
San Jose State University SJSU ScholarWorks Master's Theses Master's Theses and Graduate Research 2008 Analysis of the Zodiac 340-cipher Thanǵ̆ Đaò San Jose State University Follow this and additional works at: https://scholarworks.sjsu.edu/etd_theses Recommended Citation Đao,̀ Thang,́̆ "Analysis of the Zodiac 340-cipher" (2008). Master's Theses. 3570. DOI: https://doi.org/10.31979/etd.bp2s-67qe https://scholarworks.sjsu.edu/etd_theses/3570 This Thesis is brought to you for free and open access by the Master's Theses and Graduate Research at SJSU ScholarWorks. It has been accepted for inclusion in Master's Theses by an authorized administrator of SJSU ScholarWorks. For more information, please contact [email protected]. ANALYSIS OF THE ZODIAC 340-CIPHER A Thesis Presented to The Faculty of the Department of Computer Science San Jose State University In Partial Fulfillment of the Requirements for the Degree Master of Science by Thang Dao May 2008 UMI Number: 1458137 INFORMATION TO USERS The quality of this reproduction is dependent upon the quality of the copy submitted. Broken or indistinct print, colored or poor quality illustrations and photographs, print bleed-through, substandard margins, and improper alignment can adversely affect reproduction. In the unlikely event that the author did not send a complete manuscript and there are missing pages, these will be noted. Also, if unauthorized copyright material had to be removed, a note will indicate the deletion. ® UMI UMI Microform 1458137 Copyright 2008 by ProQuest LLC. All rights reserved. This microform edition is protected against unauthorized copying under Title 17, United States Code. ProQuest LLC 789 E. Eisenhower Parkway PO Box 1346 Ann Arbor, Ml 48106-1346 ©2008 Thang Dao ALL RIGHT RESERVED APPROVED FOR THE DEPARTMENT OF COMPUTER SCIENCE Professor Mark Stamp fh^cMJl /<UJ?^— Professor Michael Beeson ley Herwifcf (SAVDS Inc.) APPROVED FOR THE UNIVERSITY aOi ABSTRACT ANALYSIS OF THE ZODIAC 340-CIPHER by Thang Dao The main purpose of this project is to determine whether the method used in the Zodiac 340-cipher (Z340) letter was a homophonic substitution, an improved version of the well-known simple substitution. A homophonic substitution employs a "one-to-many mapping" technique, as opposed to the "one-to-one mapping" of a simple substitution [3]. Due to the complexity of the homophonic substitution, an exhaustive solution to the Z340 is not possible in a feasible amount of time. This research proposes an approach to implement an automated solution to a homophonic substitution based on a hill-climb technique [4]. The software will be used to attempt to solve the Z340. Even if the software fails to solve the Z340, useful conclusions could be drawn. The objective is to reduce the number of methods that could have been used to encrypt the original message. ACKNOWLEDGEMENTS I would like to extend my gratitude to the followings persons. Without them, my research study could never have been completed: My advisor, Professor Mark Stamp, for his resources, invaluable insights, and patience. My committee member, Dr. Stanley Herwitz, for his motivation and editing skills. My committee member, Professor Michael Beeson, for his useful comments. And especially, to my lovely wife, Trannie Dao, for her encouragement, motivation, patience, and support. v TABLE OF CONTENTS 1. Introduction 1 1.1. The problem... 1 1.2. Prior work 2 1.3. Proposed solution 2 2. Zodiac Ciphers 3 2.1. Introduction to Zodiac ciphers 3 2.2.Z408 4 2.2.1. Z408 time line 4 2.2.2. Z408 Part 1, sent to Vallejo Times-Herald 5 2.2.3. Z408 Part 2, sent to San Francisco Chronicle 5 2.2.4. Z408 Part 3, sent to San Francisco Examiner 6 2.2.5. Z408, the original message 6 2.3.Z340 6 2.3.1. Z340 time line 6 2.3.2. Z340, sent to San Francisco Chronicle 7 vi 2.4. Z13 - The Zodiac's 3rd cipher 8 2.4.1. Z13 time line 8 2.4.2. Z13, sent to San Francisco Chronicle 9 2.5. Z32 - The Zodiac's 4th cipher 9 2.5.1. Z32 time line 9 2.5.2. Z32, sent to San Francisco Chronicle 9 3. Analysis of Zodiac Ciphers 10 3.1.Z408 10 3.1.1. Z408 decryption method 10 3.1.2. Z408 cipher alphabet 10 3.1.3. Z408 plaintext - ciphertext mappings 12 3.1.4. Z408 known errors 12 3.1.5. Z408 letters' frequency and theoretical keyspace 14 3.2.Z340 14 3.2.1. Z340 cipher alphabet 14 3.2.2. Z340 letters' frequency and theoretical keyspace 16 vii 3.3. Comparison between Z408 and Z340 16 3.3.1. Cipher class 16 3.3.2. Zodiac alphabet and a special character 17 4. Z340 Possible Encryption Methods 18 4.1. Rationale for selecting possible encryption methods 18 4.2. Simple substitution 20 4.2.1. Definition 20 4.2.2. Dictionary-based attacks 21 4.2.2.1. Overview 21 4.2.2.2. Disadvantages 22 4.2.3. Statistics-based attacks 22 4.3. Z340 possible encryption methods 23 4.3.1. One-time pad 23 4.3.2. Polyalphabetic substitution 25 5. Description of the Homophonic Substitution 26 6. Analysis of the Homophonic Substitution 28 viii 6.1. Theoretical keyspace 28 6.2. Dictionary-based attacks 28 6.3. Statistics-based attacks 29 7. Modifications to normal Frequency-based attack 30 7.1. Greedy algorithm variants 30 7.2. Employing higher-level N-graphs 31 8. Hill-climb Algorithm 32 8.1. Introduction 32 8.2. A single local optimum search 32 8.3. Hill-climb Algorithm Advantages 34 8.4. Hill-climb Algorithm Disadvantages 35 9. Structure Design of HCA on Homophonic Substitution 36 9.1. Selecting starting nodes 36 9.2. Finding and swapping adjacent nodes 40 9.3. Score calculation formula 42 10. Test Suite 1 and Results 44 ix 10.1. Test Suite 1 44 10.1.1. Original message and its corresponding ciphertext 44 10.1.2. Plaintext letters'frequency 46 10.1.3. Cipher symbols'frequency 46 10.1.4. Test Suite 1 actual plaintext-ciphertext mappings 47 10.2.1st experimental run 47 10.3. Discussion 48 11. Hill-climb Algorithm Optimization 48 11.1. Randomization Algorithm 48 11.2. Improved score calculation formula 49 12. Test Suite 1 Results using Optimized Hill-climb Algorithm 50 12.1. Definition of a Crib 50 12.2. Report format 50 12.3. 2nd experimental run - Test 1 - No Crib used 51 12.4. 2nd experimental run - Test 2-1 known Crib 52 12.5. 2nd experimental run - Test 3-2 known Cribs 54 x 12.6.2nd experimental run - Test 4-3 known Cribs 55 12.7. Discussion 57 13. Test Suite 2 and Results 57 13.1. Test Suite 2 57 13.1.1. Original message 57 13.1.2. Plaintext letters'frequency 58 13.1.3. Cipher symbols'frequency 59 13.1.4. Test Suite 2 actual plaintext-ciphertext mappings 59 13.2. Results 60 13.2.1.3rd experimental run - Test 1 - No Crib used 60 13.2.2. 3rd experimental run - Test 2-1 known Crib 60 13.3. Discussion 61 14. Applying the Optimized Hill-climb Algorithm to Z340 62 14.1. Test run 1 - No Crib 62 14.2. Test run 2 - 1 Crib 63 15. Conclusions 65 xi References 67 Appendix A: Test Suite 2 message 69 Appendix B: Zodiac Cover Letters 76 xii LIST OF TABLES Table 1: Z408 in numeric form 10 Table 2: Z408 plaintext-ciphertext mappings 12 Table 3: Z408 inconsistency 13 Table 4: Z340 in numeric form 15 Table 5: Hill-climb algorithm: total keyspace after ten swappings 40 Table 6: Test Suite 1: ciphertext in numeric form 45 Table 7: Test Suite 1: results using original HCA 47 Table 8: Test Suite 1: 2nd experimental run: test 1 result 51 Table 9: Test Suite 1: 2nd experimental run: test 2 result 53 Table 10: Test Suite 1: 2nd experimental run: test 3 result 54 Table 11: Test Suite 1: 2nd experimental run: test 4 result 55 Table 12: Test Suite 2: 3rd experimental run: test 1 result 60 Table 13: Test Suite 2: 3rd experimental run: test 2 result 61 Table 14: Z340 Test run 1 62 Table 15: Z340 Test run 2 64 xiii LIST OF FIGURES Figure 1: Z408 Part 1 5 Figure 2: Z408 Part 2 5 Figure 3: Z408 Part 3 6 Figure 4: Z340 8 Figure 5: Zodiac's "My name is..." cipher 9 Figure 6: Zodiac's "Button" cipher 9 Figure 7: Z408 symbols' frequency 14 Figure 8: Z340 symbols' frequency 16 Figure 9: An example of simple substitution mappings 20 Figure 10: An example of a Caesar cipher 25 Figure 11: An example of a Homophonic substitution 27 Figure 12: An example of two local optima (Illustrated by Apple Grapher software in 3D mode) 34 Figure 13: An example of the Hill-climb algorithm advantages (Illustrated by Apple Grapher software in 2D mode) 35 xiv Figure 14: An example of the Hill-climb algorithm disadvantages (Illustrated by Apple Grapher software in 3D mode) 36 Figure 15: English letters frequency 38 Figure 16: Test Suite 1 plaintext letters' frequency 46 Figure 17: Test Suite 1 ciphertext letters frequency 46 Figure 18: Test Suite 1 actual plaintext-ciphertext mappings 47 Figure 19: Test Suite 2 plaintext letters' frequency 58 Figure 20: Test Suite 2 ciphertext letters' frequency 59 Figure 21: Test Suite 2 actual plaintext-ciphertext mappings 59 Figure 22: Z408 Part 1 cover letter 76 Figure 23: Z408 Part 2 cover letter 77 Figure 24: Z408 Part 3 cover letter 78 Figure 25: Z340 cover letter 79 Figure 26: Z13 cover letter 80 Figure 27: Z32 cover letter 81 xv LIST OF LISTINGS Listing 1: Hill-climb algorithm: a single local optimum search 33 Listing 2: Hill-climb algorithm: selecting starting nodes 38 Listing 3: Hill-climb algorithm: finding swappable nodes .41 Listing 4: Hill-climb algorithm: score calculation formula 43 Listing 5: Hill-climb algorithm: apply randomization 49 xvi 1.