The Program: Setting up classes and understanding tokenization The first step in encrypting/decrypting messages is to parse the messages into words before applying the encryption/decryption algorithms to them. This parsing process is called “tokenization.” Read the contents of a file into this array using the getline command. The objective of this assignment is to demonstrate the use of pointers in a program utilizing c-strings and tokenization. The use of pointers is foundational in C++. This program provides an exercise in using pointers, passing them into functions, using them as return data types, and leveraging them in traversing arrays Instructions Since many of you are studying the field of Cyber Security, you may find this assignment to be especially interesting. Your job is to write a program to encrypt outgoing messages and decrypt incoming messages using a Vigenere Cypher. In this assignment, you will parse a string of words from a file into tokens using the strtok_s command with pointers and then use the Vigenere Cypher algorithm to encrypt and decrypt the parsed words. Before you can perform any encryption/decryption activities, the first step is to read in messages from a file and parse the messages into individual words. The first step in encrypting/decrypting messages is to parse the messages into words before applying the encryption/decryption algorithms to them. This parsing process is called “tokenization.” Tokenization: The process of parsing sentences into words is called tokenization. To tokenize a sentence into words, use the C++ function strtok_s. [Note: do not try to use the C++ strtok function because it has been deemed unsafe and has therefore been deprecated.] In your “client” code (i.e. the file that contains your main function), you will need to declare a character array that will hold 1000 characters. Read the contents of a file into this array using the getline command. To view a discussion on how to use getline with a file object, see this link: There should be two classes in your program: Vigenere and Message. Vigenere contains the encryption key and the logic for encrypting and decrypting individual words. Message contains a vector of words that have been encrypted or decrypted and the logic for calling the functions in the Vigenere class to encrypt or decrypt a word. The Message class serves as a middle-man between your client code and the Vigenere class and holds the encrypted/decrypted results in a vector. Vigenere Class Data Member: string key Functions: Vigenere() ßconstructor void setKey(string k) string getKey() string toUpperCase(string k) string encrypt(string word) string decrypt(string word) The Vigenere class should store an encryption key in a data member called “key.” The class should have a one-argument constructor that receives a string that represents the encryption key. The encryption key must be in all capital letters for the encryption and decryption algorithms to work. Therefore, before setting the encryption key’s value, it should first be converted entirely to upper case. Do this in your toUpperCase function. There should be two classes in your program: Vigenere and Message. Vigenere contains the encryption key and the logic for encrypting and decrypting individual words. Message contains a vector of words that have been encrypted or decrypted and the logic for calling the functions in the Vigenere class to encrypt or decrypt a word. The Message class serves as a middle-man between your client code and the Vigenere class and holds the encrypted/decrypted results in a vector. Class Construction: Details Vigenere Class Data Member: string key Functions: Vigenere() ßconstructor void setKey(string k) string getKey() string toUpperCase(string k) string encrypt(string word) string decrypt(string word) The Vigenere class should store an encryption key in a data member called “key.” The class should have a one-argument constructor that receives a string that represents the encryption key. The encryption key must be in all capital letters for the encryption and decryption algorithms to work. Therefore, before setting the encryption key’s value, it should first be converted entirely to upper case. Do this in your toUpperCase function
Instructions
Your job is to write a program to encrypt outgoing messages and decrypt incoming messages using a Vigenere Cypher.
In this assignment, you will parse a string of words from a file into tokens using the strtok_s command with pointers and then use the Vigenere Cypher
Before you can perform any encryption/decryption activities, the first step is to read in messages from a file and parse the messages into individual words.
The Program: Setting up classes and understanding tokenization
The first step in encrypting/decrypting messages is to parse the messages into words before applying the encryption/decryption algorithms to them. This parsing process is called “tokenization.”
Read the contents of a file into this array using the getline command.
The objective of this assignment is to demonstrate the use of pointers in a program utilizing c-strings and tokenization. The use of pointers is foundational in C++. This program provides an exercise in using pointers, passing them into functions, using them as return data types, and leveraging them in traversing arrays
Instructions
Since many of you are studying the field of Cyber Security, you may find this assignment to be especially interesting.
Your job is to write a program to encrypt outgoing messages and decrypt incoming messages using a Vigenere Cypher.
In this assignment, you will parse a string of words from a file into tokens using the strtok_s command with pointers and then use the Vigenere Cypher algorithm to encrypt and decrypt the parsed words.
Before you can perform any encryption/decryption activities, the first step is to read in messages from a file and parse the messages into individual words.
The first step in encrypting/decrypting messages is to parse the messages into words before applying the encryption/decryption algorithms to them. This parsing process is called “tokenization.”
Tokenization:
The process of parsing sentences into words is called tokenization. To tokenize a sentence into words, use the C++ function strtok_s. [Note: do not try to use the C++ strtok function because it has been deemed unsafe and has therefore been deprecated.]
In your “client” code (i.e. the file that contains your main function), you will need to declare a character array that will hold 1000 characters.
Read the contents of a file into this array using the getline command. To view a discussion on how to use getline with a file object, see this link:
There should be two classes in your program: Vigenere and Message.
Vigenere contains the encryption key and the logic for encrypting and decrypting individual words.
Message contains a
Vigenere Class
Data Member: string key
Functions: Vigenere() ßconstructor
void setKey(string k)
string getKey()
string toUpperCase(string k)
string encrypt(string word)
string decrypt(string word)
The Vigenere class should store an encryption key in a data member called “key.”
The class should have a one-argument constructor that receives a string that represents the encryption key. The encryption key must be in all capital letters for the encryption and decryption algorithms to work. Therefore, before setting the encryption key’s value, it should first be converted entirely to upper case. Do this in your toUpperCase function.
There should be two classes in your program: Vigenere and Message.
Vigenere contains the encryption key and the logic for encrypting and decrypting individual words.
Message contains a vector of words that have been encrypted or decrypted and the logic for calling the functions in the Vigenere class to encrypt or decrypt a word. The Message class serves as a middle-man between your client code and the Vigenere class and holds the encrypted/decrypted results in a vector.
Class Construction: Details
Vigenere Class
Data Member: string key
Functions: Vigenere() ßconstructor
void setKey(string k)
string getKey()
string toUpperCase(string k)
string encrypt(string word)
string decrypt(string word)
The Vigenere class should store an encryption key in a data member called “key.”
The class should have a one-argument constructor that receives a string that represents the encryption key. The encryption key must be in all capital letters for the encryption and decryption algorithms to work. Therefore, before setting the encryption key’s value, it should first be converted entirely to upper case. Do this in your toUpperCase function.

![Option 2 – Decrypt file
When the user selects option 2, he or she should immediately be prompted to enter the
name of the file to be decrypted: [Note that the file name can contain spaces.]
Enter the name of the file to decrypt: The Lords Prayer (Encrypted).txt
Your program should open the file and read its contents into a character array using the getline
function. As soon as the file's contents have been read into the character array, main() should
print the contents of the array to the screen.
HBZ YHBZGR POQUJ TYB BU ALINGN AHTDQWRE UL MOG GHUW MOG DPVYFOZ WUW MOG PPTD UL WV
W BU XHZLJ TZ BA BZ BU ALINGN ZPDW NZ MOQK WHG HBZ WHQDA UYMSF TUL YVZYKVR NZ HBZ
MYMKRAFTIS TZ PL YVZYKVR MOME MOIL MYMKRAFT TNIAPSG NZ TUL ELIV NZ GVB BUBG MLUHVAG
JSN UBB WLTAXEE NZ YYWE XCQD YVZ MOQFG BZ MOM DPVYFOZ MOM IVEWT TUL MOM ZSWJA YVZ X
CMJ TUL XCMJ TTME
Next, using the strtok_s function as described above, tokenize the entire message into separate
words. As each word is tokenized, call the decryptWord function in the Message class (using
the Message object to invoke the function and passing in each token as an argument ONE AT A
TIME).
The decryptWord function in the Message class should receive the token as a char* data type
and immediately cast it into a string variable. It should then pass this string into the decrypt
function in the Vigenere class using the Vigenere object that is a data member in the Message
class. Once the word is decrypted, the decryptWord function in the Message class should push
the decrypted word onto the vector of words in the Message class.
This process is repeated until the entire file's contents have been tokenized and decrypted.
Once the entire file has been tokenized and its decrypted words have been stored in the vector of
words in the Message class, main() should call the function in the Message class to create a new
file that contains the decrypted words. Therefore, the user must next be prompted to enter the
name of the file in which the decrypted data will be stored.
The program wil1 then create a new file based on the name that the user entered, and that file will
contain the contents of the words vector in the Message class. Recall that this vector contains
the words that are now decrypted. Therefore, main) should call the showWords function in the
Message class to print the contents of the words vector to the screen and then call the makeFile
function in the Message class to create the file and print the contents of the vector to the file.
After the file is created and its contents displayed to the screen, the Main Menu should be
redisplayed.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc15a87b4-2574-416f-9928-ee42886c4828%2F10d386e4-341f-4dd9-9c83-10b529e9f563%2Fceliudb_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 12 images









