Question

In: Computer Science

Project Description: In groups of four students, implement (New Encryption Algorithm) character oriented and apply it...

Project Description:
In groups of four students, implement (New Encryption Algorithm) character oriented and apply it using any programming Language that you are familiar with to encrypt and decrypt your name.

Your work should cover:

1. Create the algorithm and explain (encryption-decryption) using block diagram.
2. Mention whether will you use the keys or not in your algorithm.
3- If you will use keys, explain how to generate the keys.
2. Display the generated keys
3. Encrypt your name
4. Display the plain text
5. Display the cipher text
6. Decrypt the cipher text to get the plaintext.

Solutions

Expert Solution

#include <iostream>
#include <stdlib.h>
#include <ctime>
using namespace std;
  
// This function receives text and shift and
// returns the encrypted text
string encrypt(string text, int s)
{
string result = "";
  
// traverse text
for (int i=0;i<text.length();i++)
{
// apply transformation to each character
// Encrypt Uppercase letters
if (isupper(text[i]))
result += char(int(text[i]+s-65)%26 +65);   //Calculate: Y = (X + K) % 26 (step 2 in algorithm)
  
// Encrypt Lowercase letters
else
result += char(int(text[i]+s-97)%26 +97);   //Calculate: Y = (X + K) % 26 (step 2 in algorithm)
}
  
// Return the resulting string
return result;
}

// This function receives text and shift and
// returns the decrypted text
string decrypt(string text, int s)
{
string result = "";
  
// traverse text
for (int i=0;i<text.length();i++)
{
// apply transformation to each character
// decrypt Uppercase letters
if (isupper(text[i]))
result += char(int(text[i]-s-65)%26 +65); //Calculate: Y = (X - K) % 26 (step 2 in algorithm)
  
// Encrypt Lowercase letters
else
result += char(int(text[i]-s-97)%26 +97);   //Calculate: Y = (X - K) % 26 (step 2 in algorithm)
}
  
// Return the resulting string
return result;
}
// Driver program to test the above function
int main()
{
string text;
   cout<<"Enter your Name :";
cin>>text;
cout << "Text : " << text;
int key;
srand((unsigned) time(0)); //To avoid the repetitive sequence, you must set the seed as an argument to the srand() method.
key = rand() % 20+1;         // generate a random key in a range of 1 to 20
   cout<<"\nKey ="<<key;
string cipherText = encrypt(text, key); // encrypt function is called with randomly generated key
string plainText = decrypt(cipherText, key); // decrypt function is called with previously randomly generated key
cout << "\nCipher Text: " << cipherText;
   cout << "\nOriginal Text: " << plainText;
return 0;
}

algorithm of encryption

For every letter in the message M :

1. Convert the letter into the number that matches its order in the alphabet starting from 0, and call this number X.
( A=0, B=1, C=2, ...,Y=24, Z=25)

2. Calculate: Y = (X + K) % 26

3. Convert the number Y into a letter that matches its order in the alphabet starting from 0.

algorithm of decryption

For every letter in the message M :

1. Convert the letter into the number that matches its order in the alphabet starting from 0, and call this number X.
( A=0, B=1, C=2, ...,Y=24, Z=25)

2. Calculate: Y = (X - K) % 26

3. Convert the number Y into a letter that matches its order in the alphabet starting from 0.

Main Function   encrypt function

decrypt function

​​​​​​​


Related Solutions

Project 4 – The Nearest Neighbors Classification Algorithm This project will require you to implement a...
Project 4 – The Nearest Neighbors Classification Algorithm This project will require you to implement a version of the Nearest Neighbors classification algorithm. This version, the Three Nearest Neighbors (or 3NN for short), is one of the more intuitive classification algorithms, and one of the easier ones to code. This Nearest Neighbors family of algorithms is useful because it does not require any special “training” to work. You simply need previous data to compare to. What is classification? With classification,...
This week, you will create and implement an object-oriented programming design for your project. You will...
This week, you will create and implement an object-oriented programming design for your project. You will learn to identify and describe the classes, their attributes and operations, as well as the relations between the classes. Create class diagrams using Visual Studio. Review the How to: Add class diagrams to projects (Links to an external site.) page from Microsoft’s website; it will tell you how to install it. Submit a screen shot from Visual Studio with your explanation into a Word...
Below are data for the number of students in each of four age groups that are...
Below are data for the number of students in each of four age groups that are enrolled in several local schools: Age Group Franklin School Lowell Public School JeanneD’arc School International School Toddlers (1 – 4 yrs.) Pre-adolescents (5 - 8 yrs.) Adolescents (9 - 12 yrs.) Teens (13 - 18 yrs.) 0 56 131 0 36 52 51 64 0 24 98 111 34 41 52 69 Using the included data file and SPSS, create a separate Pie Chart...
Please Select a Product and Make it on that product Project Description: Student groups will select...
Please Select a Product and Make it on that product Project Description: Student groups will select an industrial project to be developed throughout the semester. Students groups will select an appropriate project and define measurable project objectives and requirements. A project plan and schedule will be generated as well as resources allocated to accomplish project objectives. Prepare a group project for the class. Use as your model one of the following 1. Construction project 2. Software development project 3. Events...
Problem: Make linkedList.h and linkList.c in Programming C language Project description This project will require students...
Problem: Make linkedList.h and linkList.c in Programming C language Project description This project will require students to generate a linked list of playing card based on data read from a file and to write out the end result to a file. linkedList.h Create a header file name linkedList Include the following C header files: stdio.h stdlib.h string.h Create the following macros: TRUE 1 FACES 13 SUITS 4 Add the following function prototypes: addCard displayCards readDataFile writeDataFile Add a typedef struct...
Create a service level agreement to a company/organizationInstructionsIn this project, students work in groups...
Create a service level agreement to a company/organizationInstructionsIn this project, students work in groups to develop a service level agreement for fictitious organization from the customer perspective. The SLA is the legally binding document between a company and a service provider(s). The document describes the exact services and service levels, with details about all agreements.In this project, your group needs to first come up with a fictitious business organization that needs an IT service which is provided by an outside...
What are the four keys groups of issues in software project development? Describe each of the...
What are the four keys groups of issues in software project development? Describe each of the groups with examples
Mr. Cicardo arranged his second grade students in groups of four to accommodate group work for...
Mr. Cicardo arranged his second grade students in groups of four to accommodate group work for math. Students keep their desks in this arrangement at all times. During spelling tests, Mr. Cicardo reminds students to look only at their papers and demonstrate their individual ability to spell the words. Occasionally, he finds students looking at a neighbor's paper anyway. During language arts lessons, Mr. Cicardo often sees students mouthing messages to one another in their groups, and he reminds them...
Using a WACC of 15%, apply four capital budgeting techniques to evaluate the project, assuming the...
Using a WACC of 15%, apply four capital budgeting techniques to evaluate the project, assuming the Free Cash Flows are as follows: Years Free Cash Flows 0 $ (252,000.00) 1 $ 118,625.00 2 $ 127,125.00 3 $ 181,000.00 The four techniques are NPV, IRR, MIRR, and discounted Payback. Assume the reinvestment rate to be 8% for the MIRR. Also, assume that the business will only accept projects with a payback period of two and half years or less.
Create a new Visual Studio console project named assignment042, and translate the algorithm you developed in...
Create a new Visual Studio console project named assignment042, and translate the algorithm you developed in Assignment 04.1 to C++ code inside the main() function. Your program should prompt for a single 9-digit routing number without spaces between digits as follows: Enter a 9-digit routing number without any spaces: The program should output one of: Routing number is valid Routing number is invalid A C++ loop and integer array could be used to extract the routing number's 9 digits. However...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT