Student: Stanley

Monoalphabetic Substitution Cipher: Shift, Caesar, Key sentence.

Modification Exercise M 01 In Modification Exercises, you will be given working code. You will need to understand the code, and modify it. This exercise involves encryption & decryption. Below is a diagram that shows that the starting point is plaintext. This is the readable message. The process of encryption creates ciphertext, a form of the message that is, ideally, NOT readable by anyone except the intended receipient. The ciphertext is transmitted. Once received, it must undergo a process of decrpytion which restores the message to its original form: plaintext. --> encrypt --> / \ / \ plaintext ciphertext \ / \ / # Use the pencil, above. Upload your here to this repository. Part II: Monoalphabetic Subsitution Cipher: "Key Sentence" Consider the sentence: `THE QUICK BROWN FOX JUMPED OVER LAZY DOGS" Use the given sentence above as the basis for a new substitution cipher, as follows: alphaPlain = 'ABCDEFGHIJKLMNOPQRSTUVWYYZ ' alphaCiphr = 'THEQUICKBRO... Complete the alphaCiphr. Each time a letter appears for the first time in the sentence (The quick brown fox jumped over lazy dogs) it is added to the alphaCiphr. Any time a letter appears in the sentence for a second or more time, it is ignored. In this manner, the alphaCiphr is a complete alphabet, but the sequence is NOT known! Comment-out your first alphaCiphr from Part I and replace it with the one for Part II. As a test, run your with the following plaintext; it should produce the ciphertext: plaintext: HELLO WORLD ciphertext: KUWWX ZXPWQ Now, using the substitution cipher (based on the sentence), decrypt: GXL IXLFQ BV ciphertext: GXL IXLFQ BV plaintext: # Use the pencil, above. Be sure to upload this new version of your Yes, use the same name. The git/gitHub revision history will preserve the different versions. Furthermore, your original alphaCiphr and your current one should both be in your program now. Part III: Describe the role of the dictionary, dict, in these programs In your own words, please describe the role of the Python dictionary, dict, in these samples of monoalphabetic substitution ciphers. BEGIN Push "the pencil" in the upper right, find & erase this text and type your response here over this sentence. END '''\ Substitution cipher: Encrypt ''' # the alphabets alphaPlain = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' alphaCiphr = 'GHIJKLMNOPQRSTUVWXYZABCDEF ' # initialize the main dictionary dEncrypt = {} for i in range(len(alphaPlain)): dEncrypt[alphaPlain[i]] = alphaCiphr[i] # print(dEncrypt) textPlain = 'HELLO WORLD' print(' plaintext:', textPlain) # IMPORTANT: In Python, strings, str, are FIXED, and cannot be modified! # On the other hand: programmers can .append() elements to lists # So, we build-up the ciphertext using a list, and we will # convert the list to a string later. listCipher = [] # run through each character of the plaintext for a in textPlain: listCipher.append(dEncrypt[a]) # for each letter in plain, substitute # Now, convert the listCipher to a string: textCipher textCipher = ''.join(listCipher) print('ciphertext:', textCipher)

Budget: $23.00

Due on: April 24, 2020 00:00

Posted: 12 months ago.

Answers (0)