An Expert System for Solving Simple Cryptograms Carolyn Rucci Dr. Ralph Morelli 1 year project Goal Cryptanalysis Techniques Encrypted text Advantage: Perform a few quick, simple tests to determine cipher instead of having to try all ciphers. Background Information The Art of Secret Writing. Analysis Decryption Analysis and decipherm ent of encrypted messages What is an Expert System? CipherExpert knowledge Reasons about ciphers WWI Cryptographer Makes informed, intelligent decisions Cipher Expert Prototype that uses a limited set of historical ciphers: Transposition, Caesar, Affine, Vigenere and Playfair Jess Expert System Main Java Class Expert System Core Hcrypto Decryption Classes (Java) Hcrypto Analyzer classes (Java) Computer Science department libraries How Does the Expert System Work? Creates decision tree with ciphers Ciphers Substitution Transposition Simple- Caesar Poly- Affine Playfair Distribution of Letter Frequencies 70 Vigenere Index of Coincidence 60 60 50 Used to determine where to go in tree 50 40 30 20 10 0 40 30 20 10 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Distribution based on an English text A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Measure of how flat the distribution is Easily Extensible Want to add new cipher to system: Create new rules distinguishing it from other ciphers Letter frequency distribution of new cipher Ciphers Substitution SimpleCaesar Transposition PolyAffine Playfair Rail Fence Vigenere New Cipher Testing Tested CipherExpert 36 times, using 3 texts of varying length Determined Cipher Decrypted Text Short Text (36 chars) 10 / 12 10 / 12 Medium Text 11 / 12 10 / 12 12 / 12 12 / 12 33 / 36 32 / 36 (500 chars) Long Text (1500 chars) Overall Flow Chart Cipher Text false false IC<=.0455 Cipher is Playfair false Cipher is Vigenere false Error true IC >= .058 true Same freqs present IC = Index of coincidence Shift freq. = normal true Cipher is Affine Cipher dist = normal dist true Cipher is Caesar true Cipher is transposition Goal Use cryptanalysis techniques to determine which historical cipher was used to encrypt a text Use that cipher to decrypt the text Advantage: More efficient and accurate than other methods. Easily Extensible What is an Expert System Collaboration between a domain expert and an artificial intelligence specialist Rules are based on experts’ knowledge Inference Engine uses rules in knowledge base to “reason” Example: Doctor diagnosing a patient. Patient response User Sends answer User Interface asks question about symptoms Sends characteristics Inference Engine Sends question or diagnosis Knowledge Base Sends possible result or asks for more data Summary of Findings Index of Coincidence Frequency Distribution (compared to normal) Transposition ~6.68% Same Caesar ~6.66% Will match if shifted 3 to right Affine ~6.66% Same frequencies present but in different orders Vigenère ~4.38% Flat distribution Playfair ~4.72% Flat distribution NOTE: These values are for texts of ~2000 characters. For Vigenère and Playfair ciphers, keyword must be at least 4 letters, to ensure these values. Cryptanalysis Uses analytical techniques to decrypt a message when the key is unknown. – Letter Frequencies abcdef ghijklmnopqrstuvwxyz monographic frequency distribution of normal alphabet – Index of Coincidence thisisatestoftheindexofcoincidenceinmessages thisisatestoftheindexofcoincidenceinmessagesthi 5matches / 44letters ~ 11% Cipher Set Simple Substitution Ciphers One cipher alphabet 1. 2. Transposition—Flips the message hello olleh Caesar—Shifts each letter by 3 3. Plain alphabet: a b c d e f g h i j k l m n o p q r s t u v w x y z Caesar alphabet d e f g h i j k l m n o p q r s t u v w x y z a b c Affine C = (aP + b) mod 26 a & b integer contants, C = cipher letter, P = plain text letter one-to-one relationship between letters Ciphers (cont.) Vigenère – – – Many cipher alphabets created based on keyword Length of keyword = # of alphabets Cycle through alphabets when encrypting a message Playfair – two letter pairs D B M W I C O X G E Q Y R F S Z A K T P L U H M V Case1: 2corners replace w/other corners Case2: same row replace w/letters to right Case3: same column replace w/letters below