Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON I need the solution code and explanation if possible Thanks Implement a simple encryption algorithm that works as follows: - The algorithms use a

PYTHON

I need the solution code

and explanation if possible

Thanks

image text in transcribed

Implement a simple encryption algorithm that works as follows: - The algorithms use a numerical private key named key. Each character in the original text is enerypted as the character resulting from multiplying the ASCII code of that character with the key. For example to encrypt " A " \[ \text { enc_char = chr(ord } \left.\left({ }^{*} A^{* \prime} ight) * \text { key } ight) \] A. Write a function named ecrypt_file that takes as an argument the file name to be encrypted, the name of the output file (where to store the encrypted text), and the encryption key. The function opens the first file, enerypted the text according to the algorithm above, and stores the encrypted text in the second file. B. Write a multithreaded program that attempts to encrypt the contents of 10 different files concurrently using the function eerypt_file defined in the previous step. You need to create one thread of execution to process each file. Your program asks the user to input the names of the text files to be encrypted. Exercises 2: For this question, only consider the "usual" alphabet composed of characters in [A-Z]. You can assume that all the input values will be valid. Implement a SimpleCipher class as a subclass of threading (Thread). The SimpleCipher has: - A data member called private_key. - A proper constructor. - A method called ecrypt_file takes as an argument the file name to be encrypted and the name of the output file (where to store the encrypted text). - The method opens the first file and encrypted the text according to the following algorithm: A. Each letter in the original file is replaced by letter n positions to the right down the alphabet (if you reach the Z continue from the A ); for example, if n is 2, then the letter B is replaced by D, and the letter Y is replaced by A, and so on. n is the private_key. Characters not in the range [AZ] are not encrypted. B. Write a multithreaded program that attempts to encrypt the contents of 10 different files concurrently using the SimpleCipher class defined in the previous step. You need to create one thread of execution to process each file. Your program asks the user to input the names of the text files to be enerypted

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_2

Step: 3

blur-text-image_3

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

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago

Question

Describe three other types of visual aids.

Answered: 1 week ago