Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to meaningless characters, and decryption is used to transform meaningless characters into

Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to meaningless characters, and decryption is used to transform meaningless characters into meaningful text. The algorithm that does the encryption is called a cipher.

A simple encryption algorithm is Caesar cipher, which works as follows: replace each clear text letter by a letter chosen to be n places later in the alphabet. The number of places, n, is called the cipher key.

For example, if the cipher key is 3, the clear text “HELLO THERE” becomes “KHOOR2WKHUH”.

 

Here, we restrict ourselves to encrypting/decrypting digits (0…9), lowercase, uppercase alphabetic characters and space. Assume that these characters have the decimal representation from 0 to 62 as follows:

0 1 ………........…….910  11  12 ………….3536   37  38 ………..….61    62
0 1 2 3 4 5 6 7 8 9a     b    c ………..…....zA     B    C ………....…..Z   space

 

Hint: The following formula can be used to encrypt a character C using the Caesar cipher algorithm:

E = (C + k) % 63  [where k is the cipher key]

You need to figure out the formula for decrypting text on your own.

NOTE: the user may enter any key value.

Write a Python/C++ program for encrypting and decrypting a given string. Since this program performs two different functionalities (encryption and decryption), prompt the user to select the type of cryptographic technique as shown below:

Welcome to Cryptographic Techniques Program

Please enter your selection:

  1. Encrypt
  2. Decrypt

Please enter the key K

 

When the user selects 1 or 2, s/he will be asked to specify an input and output message.

Here is an example:

Assume that the user enters the following message:

HOW ARE YOU DOING?

If the user selects to encrypt the message (i.e. option 1), the program will encrypt the original message and outputs an encrypted text.

If the user selects to decrypt a message (i.e. option 2), the program will decrypt the encrypted text and outputs the decrypted text on the screen.

The program should give the user the option whether to continue with encrypting/decrypting messages (i.e. entering letter ‘C’) or exit the program (i.e. entering the letter ‘E’).

Step by Step Solution

3.36 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

This program allows the user to encrypt and decrypt messages using the Caesar cipher with a specifie... 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

Principles Of Information Security

Authors: Michael E. Whitman, Herbert J. Mattord

7th Edition

035750643X, 978-0357506431

More Books

Students also viewed these Programming questions