Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
Question
Book Icon
Chapter 5, Problem 8PE
Program Plan Intro

Program to encrypt a message in circular fashion

Program plan

  • Inside the “main()” function,
    • Declare “plaintext” and “key” and get input from the user.
    • Create a string of letters and then convert plaintext to ciphertext.
    • Print the encoded message.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
Example 2 Enter message to be encrypted: Dèyè mòn, gen mòn. Enter step size: -1 ORIGINAL MESSAGE Dèyè mòn, gen mòn. ENCRYPTED MESSAGE Cçxç lim, fdm lim. Enter message to be encrypted: Dèyè mòn, gen mòn. Enter step size: 0 ORIGINAL MESSAGE Dèyè mòn, gen mòn. ENCRYPTED MESSAGE Dèyè mòn, gen mòn. Enter message to be encrypted: QUIT Example 3 Enter message to be encrypted: Perfer et obdura, dolor hic tib: proderit olim. Enter step size: 8 ORIGINAL MESSAGE Perfer et obdura, dolor hic tibi proderit olim. ENCRYPTED MESSAGE Xmznmz m| wjl)zi, lwtwz pąk |qją xzwlmzą| wtqu. Enter message to be encrypted: QUIT
Substitution ciphers are encryption/decryption algorithms that replace one letter or number with another. The first attested use of a substitution cipher in military affairs was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). In caesar cipher , you replace each letter by 3rd letter on. If it is out of bound (later than Z), then round to the head (letter A) and continue the shift. For example:meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB Please write a program in Java to implement the Caesar Cipher: a. Implement the encryption algorithm. Ask the user to input one all lower case normal sentence (called plaintext) using the nextLine method, and then output the encrypted text (called ciphertext). b. Implement the decryption algorithm. Ask the user to input one encrypted sentence (i.e. ciphertext) using the nextLine method, and then output the decrypted text (i.e. plaintext).
Encrypt Caesar cipher is a kind of substitution cipher. Instead of using a substitution table, the alphabets are rotated by a number (a key). For example, if the key is 3, plaintext alphabet a would become d, and plaintext alphabet z would become c. Write a  program that implements the Caesar Cipher. You program will first prompt for the key and then for the mode (E for encryption and D for decryption) and finally for the message to be encrypted / decrypted. Your program will then output the encryption / decryption message. For this question, the input message may consists of any character, the program should encrypt or small letter case a to z only. All other characters should be kept intact after encryption or decryption.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education