Write a c++ program for encrypting and decrypting files

Assignment Help Basic Computer Science
Reference no: EM13307087

Write a C++ program for encrypting and decrypting files. 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 the Cryptographic Techniques Program

Please enter your selection:
1. Encrypt
2. Decrypt

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

This program will be tested using a .txt file.

If the user selects to encrypt the file (i.e. option 1), then the program will encrypt the original text and outputs the encrypted text to a new file.

If the user selects to decrypt the file (i.e. option 2), then the program will decrypt the encrypted text and outputs the decrypted text to a new file.

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

This program MUST be written using functions and arrays.

The program MUST and can ONLY contain the following function definitions and layout:

 

/**************************************************************
* This function displays the menu options as in the handout *
**************************************************************/
void displayMenu()
{ /* function body */ }


/**************************************************************
* This function encrypts the content of infile and saves the *
* encrypted text into outfile *
* @param infile string (file that has raw text) *
* @param outfile string (file that will have encrypted text) *
**************************************************************/
void encrypt(string infile, string outfile)
{ /* function body */ }


/**************************************************************
* This function decrypts the content of infile and saves the *
* decrypted text into outfile *
* @param infile string (file that has encrypted text) *
* @param outfile string (file that will have decrypted text) *
**************************************************************/
void decrypt(string infile, string outfile)
{ /* function body */ }


/**************************************************************
* This function takes an character and a cipher key to return *
* an encrypted character. *
* @param c is a char (the character to be encrypted) *
* @param key is an integer (cipher key given in the handout) *
**************************************************************/
char ceaserCipher(char c, int key)
{ /* function body */ }


/**************************************************************
* This function takes an encrypted character and a cipher key *
* to return a decrypted character. *
* @param c is a char (the character to be decrypted) *
* @param key is an integer (cipher key given in the handout) *
**************************************************************/
char ceaserDecipher(char c, int key)
{ /* function body */ }


/**************************************************************
* This is the main function of the program. *
* @return a value to terminate the program successfully *
**************************************************************/
int main()
{
displayMenu();
// 1. Get user input (e.g. encrypt/decrypt and filenames)
// 2. Call the appropriate function(s) to process encryption/decryption
// 3. Then, get user input to continue or exit the program
return 0;
}

 

**Please write clean code. Any code that does not meet the asking requirements will be rated 0 stars.

 

Reference no: EM13307087

Questions Cloud

What is a predefined control event : What is a predefined control event? Discuss its usage in programming.
What is the direction and magnitude of the magnetic field : A proton feels a force of 2.0 micro-Newtons in the negative x-direction when it is moving in the positive y direction with a speed of 2.0 x 107 meters per second.
What does it mean that a class is ancestor of another class : what does it mean that a class is ancestor of another class?
Determine the backwards velocity of the cannon : A cannonball (20kg) is shot from a cannon(200kg) with a velocity of 20m/s. what is the backwards velocity of the cannon
Write a c++ program for encrypting and decrypting files : Write a C++ program for encrypting and decrypting files. Since this program performs two different functionalities (encryption and decryption), prompt the user to select the type of cryptographic technique as shown below.
What is the wavelength corresponding to largest intensity : Your temperature is 98.4 degrees fahrenheit. what is the wavelength corresponding to the largest intensity
The use of strategic alternatives : Through the use of strategic alternatives, companies may compete in a marketplace, achieve its vision, or if no vision has been articulated,
Locate the image using both the spherical mirror equations : Locate the image using both the spherical mirror equation and a ray diagram and identify if it is real or virtual, upright or inverted, and smaller or larger.
What is the wavelength of kalpha x-rays emmited by iron : The K-shell ionization energy of iron is 8500 eV, What is the wavelength of Kalpha X-rays emmited by iron

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write the algorithm/logic for computing following problem

Given the dimensions of a crate (side 1, side 2, and side 3), find the largest surface area it can provide when used as a table.

  Under a mle-estimated unigram probability model

Qatar university, the largest university in qatar, aims to become the role model university in qatar and the arab region. it is also the only university in qatar that offers information retrieval courses.

  Explain global ubiquitous platform for online services

Recognize what you believe to be next set of core future service(s) to be offered via Internet over next 2 to 5 years based on current and evolving technologies.

  Finding different sizes of newspaper for local newspaper

Comprise a specific recommendation regarding how many different sizes newspaper must offer.

  Distinguish between baseband and broadband transmission

Distinguish in detail between baseband and broadband transmission?

  Write a program that displays four lines of text in four lab

Write a program that displays four lines of text in four labels

  Which method would you prefer when connecting cisco router

Which method would you prefer when connecting to a cisco router and why? Would there be an advantage to using this method over the others?

  Write code that fills an array with each set of numbers

Write code that fills an array with each set of numbers below. a. 1 2 3 4 5 6 7 8 9 10 b. 0 2 4 6 8 10 12 14 16 18 c. 1 4 9 16 25 36 49 64 81 100 d. 0 0 0 0 0 0 0 0 0 0 e. 1 4 9 16 9 7 4 9 11

  Is snort an hids or an nids

What kind of file is Snort output (logging info) stored in? 7. Can you use Snort with network switches? With hubs? 8. What operating system(s) does Snort run on?

  Explaining physical material on which computer keeps data

Storage is the physical material on which a computer keeps data, instructions, and information?

  Write a gui-based program that analyzes a round of golf

Write a GUI-based program that analyzes a round of golf. You will retrieve the data for 18 holes from a text file. On each line in the file will be the par for that hole (3, 4, or 5) and your core for that hole should be displayed in a label. Prov..

  Create a new string to represent the corresponding full name

Create a new string to represent the corresponding full name, and display it on screen in format: Lastname, Firstname, Middle name.

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