Create a program that begins by prompting the user

Assignment Help Computer Engineering
Reference no: EM132171843

Using Python, create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers), and whether they would like to encrypt or decrypt, then our implementation will add some variation to the basic algorithm to make it a little harder to decode. When encrypting:

(1) We will read the text data from the file line-by-line, and all of the transformations described below be should applied line-by-line. Before doing the transformations below you should use strip() to remove the whitespace at the ends of a line.

(2) Replace each "e" character in the original message with the letters "zw". If the file contains "Hello World!", the resulting message will be "Hzwllo World!".

(3) After replacing the "e" characters, you'll add the word "hokie" to the beginning, middle (the middle is length//2), and the end of the message. Continuing with example above the message that's actually encrypted using the Caesar Cipher is "hokieHzwllohokie World!hokie". This should be done for each line in the file.

Once you have the altered message then we will perform a slightly modified Caesar Cipher encoding as described below and print the result. Like above this transformation is applied line- by-line and shouldn't "cross" lines.

Rather than have a single shift, instead we will have 5 shift amounts entered by the user. The shifts are applied character by character. So if the user enters shift amounts: 3 4 5 6 7 and the first line of the file contains "Hello World!", your program will first transform it into "hokieHzwllohokie World!hokie" then:

"h" would be shifted by 3 characters. "o" would be shifted by 4 characters. "k" would be shifted by 5 characters. "i" would be shifted by 6 characters. "e" would be shift by 7 characters.

We then start back at the first shift amount:

"H" would be shifted by 3 characters. "z" would be shifted by 4 characters. "w" would be shifted by 5 characters. "l" would be shifted by 6 characters. "l" would be shift by 7 characters.

The space, exclamation point, and anything else that's not a letter isn't shifted, but it does "take up" a shift amount. So if the space character would have been shifted by 3 characters, the next character would be shifted by 4. This continues until the end of the line is reached. The whole process starts over with shift amount 3 on the next line in the file.

When decrypting, perform each step in reverse order. Decrypt the message using the Caesar Cipher above, then remove the "hokie" strings, then change any occurrence of "zw" to "e". You may assume the all occurrences of "zw" in the result are really "e" characters, and further you may assume the "hokie" strings are in the encrypted message at the appropriate place, however there may be other occurrences of "hokie" in the original message.

Finally, your program must be able to encrypt/decrypt an arbitrary number of messages. When you've completed the encrypting/decrypting a message the user should be asked if they want to enter another message. Your program should continue until the user types "N".

Reference no: EM132171843

Questions Cloud

Write a program that plays a modified yahtzee game : You will allow a single player to play with 5 dice. For those of you who know how to play the game, you will only play the top half of the game.
Net income is reported on the income statement : Net income is reported on the Income Statement, an accounting equation that follows GAAP, generally accepted accounting principles
Create a program that analyzes a text file and produces : Any sequence of alphanumeric characters (length >= 1) with the beginning and ending non-alphanumeric character removed counts as a word.
What is the net present value of seattle corporation : Seattle Corporation identifies an investment opportunity that will yield end of year cash flows of $30,000 in both Year 1 and Year 2
Create a program that begins by prompting the user : Create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers).
What is cabbor cost of equity capital : What is Cabbor's cost of equity capital (that is, compute the required rate of return on the stock)?
Space between the minus sign and the number : Consider a Zerobond (i.e., a bond that pays no coupon payment, meaning that the coupon rate on the bond is 0%) with a par value of $1,000 that will mature
Par value bond with a coupon rate : Compute the yield to maturity of a $1,500 par value bond with a coupon rate of 7.5% (quarterly payments - that is, four times per year) that matures in 25 years
How do organizations measure risk : Identify the major business and financial risks such as interest rate risk, foreign exchange risk, credit, commodity, and operational risks

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a console program that asks for two positive integers

Create a function called that takes in one positive integer n and returns true or false depending on whether it is a prime number

  Explain the techniques used by malware developers

Please discuss the techniques used by malware developers to disguise their code and prevent it from being analysed.

  Define the expected benefits of the new system and for

-make a ppt presentation for this each section for about 3-4 slide with a notes carda. select networking hardware and

  Write a client that removes all negative numbers from stack

Write a client that removes all negative numbers from a stack of int objects. If the original stack contained the integers 30, -15, 20, -25 (top of stack).

  Discuss about the wireless technology security

Submit an 3 page concept/idea paper IAW APA format on an approved topic (see pre-approved topics in the syllabus). Paper organization will include.

  Describe the five values held by xp teams

Describe the five values held by XP teams? Describe the strengths and weaknesses of the random paradigm team structure?

  1explain three different ways that freedom of expression

1.explain three different ways that freedom of expression is limited in spite of the unequivocal language of the

  Write your first standalone python script

Your script will utilize the following string definition. testString = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" .

  How to overcome information deficiency problem

Discuss the relationship between data, information, and knowledge. Support your discussion with at least 3 academically reviewed articles.

  Define relationships between users and permissions

Assume a system with N job positions. For job position i, the number of individual users in that position is Ui and the number of permissions.

  Calculate her encrypted pair

What are the original plaintext and signature? Is this a valid message signature pair?

  Discuss the security dimension and privacy dimension

Explain the difference between the security dimension and privacy dimension presented in the "Three-dimensional model for classifying mHealth Apps

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd