Write a C++ program called Password that handles encrypting a password. The program must perform encryption as follows: A. main method i. Ask the user for a password. ii. Sends the password to a...


Write a C++ program called Password that handles encrypting a password.


The program must perform encryption as follows:


A. main method


i. Ask the user for a password.


ii. Sends the password to a Boolean function called is Valid Password to check validity.


Returns true if password is at least 8 characters long Returns false if it is not at least 8 characters long


iii. If is Valid Password functions returns false


Print the following error message “The password must be at least 8 characters long.” Loop and ask for password again and recheck it.


iv. If is Valid Password returns true then continue.


v. Ask the user for a key


vi. Send key to a Boolean function called is Valid Key.


Returns true if key is between 1 and 10 (inclusive Returns false if not between 1 and 10 (inclusive)


vii. If is Valid Key returns false, then print the following error message and ask for the password again and recheck it. The key must be between 1 and 10, you entered X. (X is the number entered)


viii. If is Valid Key returns true continue.


ix. Send the password to function called encrypt that


1. Encrypts password using the formula below.


Returns a string representing the encrypted password.


x. Display the password and the encrypted password in a nicely formatted String such as: Your password is let main z the encrypted version of your password is rkzskot& with a key of 6.


Encryption Algorithm


a. Implement a simple shift cipher.


b. A shift cipher is a form of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet.


For example, with shift of 3, A would be replaced by D, B would become E, and so on.


c. The shift for this program will be the key entered by the user.


d. The password may be any of the characters in the ASCII table from character 33 the exclamation point ‘!’ to character 122 the lower case ‘z’.


e. If the shift causes the character to be greater than 122, the shift will continue starting with character 33.


f. Remember char can be treated like integers so adding to a char is allowed. See example code posted with this project.


g. Example: If the user entered 8 as the key and a letter in the password is lower case ‘x’ (char 120) a shift of 8 would result in the character ‘&’ (char 38).


h. Be careful as the ASCII table max char decimal number is 127, so any char that is greater than 127 will yield unexpected results. C++ string functions


a. The project requires use of the std::string class and its functions.


b. std::string length functions returns an integer representing the length.


c. std::string at function takes in an integer representing the char placement in the string and returns that char.


d. Attached to the project will be some sample code demonstrating the std::string functions needed. The project requires one files to be turned in - password.cpp (the source code of your Password program) be sure to follow the Programming Project Submission Instructions posted by your instructor on the eLearning site. The submission requirements are part of the grading for this assignment.

































May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here