Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Kindly, for me, I could not solve it in the Python program. I hope you solve it. A The program should have a main menu,

Kindly, for me, I could not solve it in the Python program. I hope you solve it. image text in transcribed
A The program should have a main menu, through which the user can choose whether he wants to encrypt a text or decryptit If the user chose to encrypt plaintext, he will be asked to enter his ID, which is also the name of the input filelie if student ID is 199999, then the input file name should be 199999.txt) The user should not enter the file extension liebt), instead, the program should append the extension to the ID automatically The input file must contain the following information Student full name Student ID Student Age ary Technologkal College - Oman Page 11 After that, the file does not exist, the program should warn the user about it. If the file exists, the program must import the data from the input file using a function The user then will be asked to choose an operation: Encryption, Decryption, or Exit 1. Encryption: the encryption process should be done through a group of steps functions) . First, calling a function to read the plaintext data unencrypted data from a file called plain.txt Then another function will be called, which is the function responsible for creating the key for encryption, the key creation process is explained below . After creating the key, a third function will be called to calculate the rounded average of the key, age, and the number of letters in the student's name . The main encryption function will proceed with encrypting the data using the created key . Finally, a function to save the ciphertext will be called to save the result to a text file. named cipher.txt 2. Decryption Similar to encryption, the decryption process will have similar functions for reading the ciphertext from cipher tat, load the key from key.txt, decrypting the cphertext, and finally saving the recovered plaintext to a file called original.txt 3. Exit: Choosing this option will exit the program F. Creating the key Step 1: Based on the student 1 (SD) and are first calculate the sum of SID digits fie SID: 190190 then sum 201 Second, find the sum age i 2018 2), and based on this number, you need to left-shift or right-shift the stof the value is 1. left shift by 1le the 190190 will become 901901), and so on for values from 1 to 9. If the value is o, then you need to do a single right-shiftie 190190 will become 019019). Finally, if the value above 9, then you need to subtract the 10 from the value le sumage 13%20-1), then 11-103 is the number of lett-shifts . Step 2: After shifting the SID the student must create the encryption key as follows Shifted ID ape length name). Example, shifted 510 901901. age 20, name Ahmed Ali, then length of name 9. The generated key 90190209 . Your program must save the key into a file called mykey.txt Using the key for encryption Since the used algorithm is Caesar's it means you need to shift the plaintext letters by a certain number, you can obtain this fumber by rounding the average of your key digts, Leif your key is 190190, the total is 20, the average s 1.33, and after rounding it becomes 3. So it means your Caesar algorithm will perform shifting by three digits. In order to increase the strength of your encryption, you must use your key after applying Caesar, as in this example: #your text is "Hello", and you applied Caesar cipher with a shift of 3, the result is khoor". If your key is 190190, your final ciphered would be "ahoo1r90". In other words, your final ciphertext is a composed of one character from the result of Caesar cipher, then the second character is from the key, and so on until you iterate over the whole plaintext (repeating the key if it is shorter than the plaintext) Your program must save the result in a file called cipher.but A The program should have a main menu, through which the user can choose whether he wants to encrypt a text or decryptit If the user chose to encrypt plaintext, he will be asked to enter his ID, which is also the name of the input filelie if student ID is 199999, then the input file name should be 199999.txt) The user should not enter the file extension liebt), instead, the program should append the extension to the ID automatically The input file must contain the following information Student full name Student ID Student Age ary Technologkal College - Oman Page 11 After that, the file does not exist, the program should warn the user about it. If the file exists, the program must import the data from the input file using a function The user then will be asked to choose an operation: Encryption, Decryption, or Exit 1. Encryption: the encryption process should be done through a group of steps functions) . First, calling a function to read the plaintext data unencrypted data from a file called plain.txt Then another function will be called, which is the function responsible for creating the key for encryption, the key creation process is explained below . After creating the key, a third function will be called to calculate the rounded average of the key, age, and the number of letters in the student's name . The main encryption function will proceed with encrypting the data using the created key . Finally, a function to save the ciphertext will be called to save the result to a text file. named cipher.txt 2. Decryption Similar to encryption, the decryption process will have similar functions for reading the ciphertext from cipher tat, load the key from key.txt, decrypting the cphertext, and finally saving the recovered plaintext to a file called original.txt 3. Exit: Choosing this option will exit the program F. Creating the key Step 1: Based on the student 1 (SD) and are first calculate the sum of SID digits fie SID: 190190 then sum 201 Second, find the sum age i 2018 2), and based on this number, you need to left-shift or right-shift the stof the value is 1. left shift by 1le the 190190 will become 901901), and so on for values from 1 to 9. If the value is o, then you need to do a single right-shiftie 190190 will become 019019). Finally, if the value above 9, then you need to subtract the 10 from the value le sumage 13%20-1), then 11-103 is the number of lett-shifts . Step 2: After shifting the SID the student must create the encryption key as follows Shifted ID ape length name). Example, shifted 510 901901. age 20, name Ahmed Ali, then length of name 9. The generated key 90190209 . Your program must save the key into a file called mykey.txt Using the key for encryption Since the used algorithm is Caesar's it means you need to shift the plaintext letters by a certain number, you can obtain this fumber by rounding the average of your key digts, Leif your key is 190190, the total is 20, the average s 1.33, and after rounding it becomes 3. So it means your Caesar algorithm will perform shifting by three digits. In order to increase the strength of your encryption, you must use your key after applying Caesar, as in this example: #your text is "Hello", and you applied Caesar cipher with a shift of 3, the result is khoor". If your key is 190190, your final ciphered would be "ahoo1r90". In other words, your final ciphertext is a composed of one character from the result of Caesar cipher, then the second character is from the key, and so on until you iterate over the whole plaintext (repeating the key if it is shorter than the plaintext) Your program must save the result in a file called cipher.but

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago