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

Choose one of the following cryptography techniques and implement it using (java )programming language. Your program...
Choose one of the following cryptography techniques and implement it using (java )programming language. 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...
In cryptography, Caesar cipher is one of the simplest encryption techniques. The key idea of this...
In cryptography, Caesar cipher is one of the simplest encryption techniques. The key idea of this method is to replace each plaintext letter with one fixed number of places down the alphabet. Below is an example with a shift of three: Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz Cipher: DEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABC To cipher a string, ‘A’ is replaced by ‘D’, ‘B’ is substituted by ‘E’, and so on. To decode a string, ‘A’ is replaced by ‘x’, etc. By using python with vs code: Write a...
Using block diagram, design the architectural layout of the simplified model of a symmetric Cryptosystem. Implement...
Using block diagram, design the architectural layout of the simplified model of a symmetric Cryptosystem. Implement a cryptosystem columnar transposition technique with a 4 x 4 matrix arrangement. Test your code with ‘cryptography’ as the plaintext. prefer python but it doesn't matter.
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...
Implement the following socket programming in C (b) Chat Application using TCP
Implement the following socket programming in C (b) Chat Application using TCP
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm...
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm to sort the digits: Use Counting Sort or Bucket Sort. • Assume the numbers are maximum 4-digit numbers. • If using Counting Sort, you can see that your digit range is between 0 and 9 ([0…9]). • If using Bucket Sort, you will have ten buckets labeled from 0 to 9. Please add comments and explain every step carefully.
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
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...
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...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT