Question: Python Program - Please include #Comments to explain each line if possible. Background The transposition cipher used in the previous lab is not a very

Python Program - Please include #Comments to explain each line if possible.

Python Program - Please include #Comments to explain each line if possible.Background The transposition cipher used in the previous lab is not avery strong form of encryption because it is easy to crack. Another

Background The transposition cipher used in the previous lab is not a very strong form of encryption because it is easy to crack. Another kind of cipher, used since the time of Caesar, is the substitution cipher, which exchanges one letter for another throughout a message. For example, if we exchange'a' for 't', then the letter 't' would be inserted into the ciphertext in each place where the letter 'a' occurs in the plaintext. Lab Exercise, 5 points design, 25 points program For this lab, you are given a file that is already encrypted using the substitution cipher and a file containing the key used to encrypt the content. Write a program to read the encrypted file, to decrypt one line at a time, and write each decrypted line into another file. Allow the user to specify the input filename and output filename. Use exception handling to check for file existence on the input file and to determine if the output file exists so you can ask the user if the output file should be overwritten or not. Prompt for another output filename if the user does not want the file overwritten or if the output filename is the same as the input filename The encrypted file contains capital letters and punctuation characters. To simplify the decryption process, only decrypt letters and leave punctuation and other characters alone. Leave uppercase letters as uppercase and lowercase letters as lowercase; for example, 'a'J't' and 'A 'T'. Also, "("is encrypted or decrypted as and as Your program must have the following function: def substitutionDecrypt CanEncrypte encryptionKey) Line, This function decrypts one line using the encryption Key Arguments are CipherText and the Encryption key used Add your code here aPlainLine #Returns the line decrypted return For example, pher Line Ifmmp Xpame file Key "bcdefghijklmnopar stuvwxyza" #a is replaced by b, b is replaced by c plainLine substitutionDecryptCcipherLine, fileKey) print (plainLine) #should print "Hello World

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!