Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment 2- Caesar Cipher Introduction Your second assignment will consist ofa

ID: 3788268 • Letter: A

Question

Assignment 2- Caesar Cipher Introduction Your second assignment will consist ofa decryption problem. Some encrypted text will be be provided and your job is to write a C program to decrypt it. As always, the C program should submitted as a standard C source code file. Please note that the computer program should comply with the commenting and formatting rules as described in class. For example, there should be a header for the whole program that gives the author's name, class name, date, and description. End braces should be commented, and there alignment and indenting requirements as discussed. Please ask if you have any questions Please provide your p seudocode as a separate Word, Dxt, or PDF file. Program 1: Caesar Cipher In cryptography, a Caesar Cipher is one ofthe simplest and most widely known encryption a techniques. It is a type ofsubstitution cipher in which each letter in the plaintext is replaced by letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would B, so on. The method is named after Julius cipher) and Caesar, who used it in his private correspondence. ABC DEF G H A B C D E F Caesar the encryption is performed against a key string, which is often just the 26 letters alphabet. An value is defined that consists of a positive or negative integer. of the The plaintext (the normal text encrypted, one letter time, by using that offset value in the following way: (a) the index position within the key string of the letter to be encrypted is determined, (b) the offset value is applied to that index in order to obtain a new index within the key string, (c) the character at the new index is written as the For a simple example, let's assume the key string consists of the 26 letters of the alphabet plus a space

Explanation / Answer

#include<stdio.h>
#include<stdlib.h>

char data[50], temp;
int key,i;

void getmessage()
{  
   printf("Enter a String: ");
   scanf(" %[^ ]s", data);
}

void key_input()
{
   printf("Enter key: ");
   scanf("%d", &key);
}

void encryption()
{
char a[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9',' '};
int n = sizeof(a)/sizeof(a[0]);
int index,j;
char temp;
   for(i = 0; data[i] != ''; i++)
   {   
   temp=data[i];
   for(j=0;j<n;j++)
   {
   if(a[j]==data[i])
   index=j;
   }
   if(index>=0 && index<=62)
   {
   index = index + key;
   if(index > 62)
   index=index - 62 - 1;
   temp=a[index];
   data[i]=temp;
   }
   }
   printf(" Encrypted Message: %s ", data);
}

int main()
{
   int ch;
   getmessage();
   key_input();
   encryption();
   return 0;
}

for the last cipher msg the key is not given.

therefore unable to find the coded answer from it. plese find the key for that and decode the msg