Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2:24 PM Sun Feb 20 moodle.oakland.edu both of which can be downloaded from the SEED website. 2 Lab Tasks 2.1 Task 1: Frequency Analysis
2:24 PM Sun Feb 20 moodle.oakland.edu both of which can be downloaded from the SEED website. 2 Lab Tasks 2.1 Task 1: Frequency Analysis Against Monoalphabetic Substitution Cipher It is well-known that monoalphabetic substitution cipher (also known as monoalphabetic cipher) is not secure, because it can be subjected to frequency analysis. In this lab, you are given a cipher-text that is encrypted using a monoalphabetic cipher; namely, each letter in the original text is replaced by another letter, where the replacement does not vary (i.e., a letter is always replaced by the same letter during the encryption). Your job is to find out the original text using frequency analysis. It is known that the original text is an English article. In the following, we describe how we encrypt the original article, and what simplification we have made. Instructors can use the same method to encrypt an article of their choices, instead of asking students to use the ciphertext made by us. Step 1: let us do some simplification to the original article. We convert all upper cases to lower cases, and then removed all the punctuations and numbers. We do keep the spaces between words, so you can still see the boundaries of the words in the ciphertext. In real encryption using monoalphabetic cipher, spaces will be removed. We keep the spaces to simplify the task. We did this using the following command: $ tr [:upper:] [:lower:] < article.txt > lowercase.txt $ tr-cd ' [a-z] [ ] [:space:]' < lowercase.txt > plaintext.txt SEED Labs - Secret-Key Encryption Lab 2 13% I 2:24 PM Sun Feb 20 2 of 7 moodle.oakland.edu Step 2: let us generate the encryption key, i.e., the substitution table. We will permute the alphabet from a to z using Python, and use the permuted alphabet as the key. See the following program. $ python >>> import random >>> s = "abcdefghijklmnopqrstuvwxyz" random.sample(s, len(s)) >>> list = >>> ''.join (list) 'sxtrwingbedpvgk fmalhyuojzc' Step 3: we use the tr command to do the encryption. We only encrypt letters, while leaving the space and return characters alone. $ tr 'abcdefghijklmnopqrstuvwxyz' sxtrwingbedpvgkfmalhyuojzc' \ < plaintext.txt > ciphertext.txt We have created a ciphertext using a different encryption key (not the one described above). You can download it from the lab's website. Your job is to use the frequency analysis to figure out the encryption key and the original plaintext. " Guidelines. Using the frequency analysis, you can find out the plaintext for some of the characters quite easily. For those characters, you may want to change them back to its plaintext, as you may be able to get more clues. It is better to use capital letters for plaintext, so for the same letter, we know which is plaintext and which is ciphertext. You can use the tr command to do this. For example, in the following, we replace letters a, e, and t in in.txt with letters X, G, E, respectively; the results are saved in out.txt. $ tr 'aet' 'XGE' < in.txt > out.txt There are many online resources that you can use. We list four useful links in the following: http://www.richkni.co.uk/php/crypta/freq.php: This website can produce the statis- tics fro a ciphertext, including the single-letter frequencies, bigram frequencies (2-letter sequence), and trigram frequencies (3-letter sequence), etc. https://en.wikipedia.org/wiki/Frequency analysis: This Wikipedia page pro- 13% I
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started