subject

9.12 LAB: The Caesar cipher In cryptography, Caesar's cipher is one of the simplest and most widely known encryption techniques. The method is named after Julius Caesar, who used it in his private communication. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. We wish to implement Caesar's encryption scheme by substituting each alphabet in the string with another alphabet that occurs three shifts to its left. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. Note that that the code wraps around in that A would be replaced by X, B would be replaced by Y, and C would be replaced by Z. Write a function called encrypt that takes two input arguments: the plaintext and the number of left shifts to use when constructing the cipher, and returns the encrypted string. For example, if the user enters plaintext = "I CAME I SAW I CONQUERED" and shift = 3, then cipher = encrypt(plaintext, shift) should return F ZXJB F PXT F ZLKNRBOBA as the cipher. Also, note that white spaces in the plaintext occur as themselves in the cipher as well. Finally, your code must work correctly for lower case letters as well as a mix of upper and lower case letters. For example, if plaintext = "I came I saw I conquered" and shift = 3, then cipher = encrypt(plaintext, shift) should return F zxjb F pxt F zlknrboba as the cipher.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
You know the right answer?
9.12 LAB: The Caesar cipher In cryptography, Caesar's cipher is one of the simplest and most widely...
Questions
Questions on the website: 13722363