Question

In: Computer Science

Implementing a cryptosystem: Choose one of the following cryptography techniques and implement it using any programming...

  1. Implementing a cryptosystem:

Choose one of the following cryptography techniques and implement it using any programming language you prefer. Your program should provide the user with two options Encryption and Decryption, with a simple UI to get the input from the user, and view the result. You can use any restriction you need for the user input but you need to clarify that and validate the user input base on your restriction.

● Feistel

● Keyword columnar

● Any cryptosystem of your choice (needs to be approved by the instructor)

Notes:

  • Submission materials:
    • Your source code
    • Report containing Description of your cryptosystem, the encryption and decryption processes, screenshots of all the execution results.
  • Make sure your code is defensive code against any programming flaws.
  • Test your program with different input.
  • You must reference your work if you used any external sources for the code or report.

Solutions

Expert Solution

In below code I have used Caesar cipher as a cryptography techniques for encryption and decryption of plain text and C++ language to implement the code.

Caesar_cipher.cpp

#include<iostream>
#include<string.h>
#include<stdlib.h>

using namespace std;

int main() {
    // User input to Encrypt text
   cout<<"Enter your Plain text:";
   char text[50];
   cin.getline(text,50);
   int i, j,n,choice,key;
   // Key or shift value which used to encrypt text
   cout << "Enter key: ";
   cin >> key;
   n = strlen(text);
   while(1){
        //user menu
   cout<<"\n1.Encryption\n2.Decryption\n3.Exit\n";
   cout<<"Enter your choice:";
   cin>>choice;

   if (choice==1){
      char word;
      for(int i = 0; text[i] != '\0'; ++i) {
         word = text[i];
        // encryption for lowercase letters
         if (word >= 'a' && word <= 'z'){
            word = word + key;
            if (word > 'z') {
               word = word - 'z' + 'a' - 1;
            }
            text[i] = word;
         }
         // encryption for uppercase letters
         else if (word >= 'A' && word <= 'Z'){
            word = word + key;
            if (word > 'Z'){
               word = word - 'Z' + 'A' - 1;
            }
            text[i] = word;
         }
      }
      // Encrypted text or result
     cout<<"\nEncrypted text:"<<text<<endl;
   }
   else if (choice == 2) {
      char word;
      for(int i = 0; text[i] != '\0'; ++i) {
         word = text[i];
        //decryption for lowercase letters
         if(word >= 'a' && word <= 'z') {
            word = word - key;
            if(word < 'a'){
               word = word + 'z' - 'a' + 1;
            }
            text[i] = word;
         }
         //decryption for uppercase letters
         else if(word >= 'A' && word <= 'Z') {
            word = word - key;
            if(word < 'A') {
               word = word + 'Z' - 'A' + 1;
            }
            text[i] = word;
         }
      }
        //  Decrypted text or result
      cout <<"\nDecrypted text:"<<text<<endl;

   }
   // For exiting the menu on operation complete
   else if (choice == 3) {
            exit(0);}
   }

}

Output :- You can see the below screenshot for output of above code.

Please hit that like or thumbs-up button, It really motivates me(It takes only 1-2 seconds,I hope you will do that?)>3

Thank you!!


Related Solutions

Implement the following socket programming in C (b) Chat Application using TCP
Implement the following socket programming in C (b) Chat Application using TCP
Use Java programming to implement the following: Implement the following methods in the UnorderedList class for...
Use Java programming to implement the following: Implement the following methods in the UnorderedList class for managing a singly linked list that cannot contain duplicates. Default constructor Create an empty list i.e., head is null. boolean insert(int data) Insert the given data into the end of the list. If the insertion is successful, the function returns true; otherwise, returns false. boolean delete(int data) Delete the node that contains the given data from the list. If the deletion is successful, the...
Choose one of the attached data sets and analyze using the techniques discussed in class up...
Choose one of the attached data sets and analyze using the techniques discussed in class up to this point. This includes the following: Find the appropriate measure of center. Discuss why the chosen measure is most appropriate. Why did you decide against other possible measures of center? Find the appropriate measure of variation. The measure of variation chosen here should match the measure of center chosen in Part 1. Find the graph(s) needed to appropriately describe the data. These may...
Give any simple and very easy example for: Programming and coding standards & Developing and implementing...
Give any simple and very easy example for: Programming and coding standards & Developing and implementing test plans
Implement a queue - C programming, please read the instruction carefully and implement queue.c using dynamic...
Implement a queue - C programming, please read the instruction carefully and implement queue.c using dynamic array structure given dynarray.h and dynarray.c below The second ADT you'll implement for this assignment is a queue. For this assignment, the interface for the queue (i.e. the structures and the prototypes of functions a user of the queue interacts with) is already defined for you in the file queue.h. Your first task in this assignment is to implement definitions for the functions that...
Question 1 Given an example on any one of the following sampling techniques (one example on...
Question 1 Given an example on any one of the following sampling techniques (one example on only one technique).  Simple random sampling  Stratified random sampling  Cluster sampling Question 2 What is the difference between sampling error and non-sampling error? Give an example on each part. Question 3 B1 B2 A1 0.12 0.31 A2 0.08 0.49 a. Find P(A1) b. Find P(A1 and B2) c. Find P(A1|B2) d. Find P(A2 or B1) e. Find (B1 and B2) Question...
Implement an appropriate backup policy Introduction: Creating a backup policy and implementing it is one of...
Implement an appropriate backup policy Introduction: Creating a backup policy and implementing it is one of the most important things that can be done for data protection. In this assignment, you build a backup policy for the following scenario: Marketing Mavericks Inc. is a ten person Marketing firm serving the local area. Their current setup consists of Windows workstations connected on a Windows based server. Individuals are mostly assigned to specific clients and mostly work on marketing campaigns involving social...
Cryptography - please use Python to complete the following task. You don't have to implement AES...
Cryptography - please use Python to complete the following task. You don't have to implement AES just import the necessary libraries. Can you fix my code? Thanks! Read in a 128 bit key from the user (16 characters). If the user enters a key of any other size it's fine to terminate the program with an error. Read in a string of arbitary length from the user. (ie, the string could be 1 character, or 50,000, or anywhere in between)....
implement a JavaFX program to demonstrate skills and knowledge using the following: 1.General Java programming skills...
implement a JavaFX program to demonstrate skills and knowledge using the following: 1.General Java programming skills (e.g. conditionals, branching and loops) as well as object-oriented concepts) 2. Writing JavaFX applications incl. using fxml 3. • GUI Layouts (organizing UI controls) I just need some samples and explanations.
implementing linked list using c++ Develop an algorithm to implement an employee list with employee ID,...
implementing linked list using c++ Develop an algorithm to implement an employee list with employee ID, name, designation and department using linked list and perform the following operations on the list. Add employee details based on department Remove employee details based on ID if found, otherwise display appropriate message Display employee details Count the number of employees in each department
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT