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

2. Caesar Cipher: De-Caesar Encrypted data on phones has been a hot topic in the

ID: 2291380 • Letter: 2

Question

2. Caesar Cipher: De-Caesar Encrypted data on phones has been a hot topic in the news lately. For this problem, we would like to help out by writing a function that can decrypt data that has been encrypted using one of the oldest encryption schemes the Caesar Cipher. The Caesar Cipher is a substitution cipher where each letter or digit in the text is replaced with a letter or digit some fixed number of positions down its alphabet ABICIDIEF GHE For example, with a shift of 3, the letter B' would be encoded as 'E', and the letter X' would be encoded as "A We would like to be able to decrypt messages encrypted using the Caesar Cipher. Only letters (upper and lower case) and digits are encrypted within their respective alphabets; al other characters remain the same. For example, with a shift of 7 (not 3), the message: Tf Tpkalyt 9 would decrypt to: My Midterm 2 (a) (10 Points). To make sure you understand the problem, we can do a hand example. For a shift of 7, decrypt the following message: LL 837 YvjrG!

Explanation / Answer

a. The decryption of LL 837 YvjrG! is EE160RockZ!

b. Start

enter character, shift.

character=((int)character - shift) mod 26

display character.

c.Program:

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

void de_caesar(char*c, int shift);

int main(void)

{

int shift = 1;

char c[101];

printf("Enter the message you want to decrypt: ");

fgets(c, sizeof(c), stdin);

printf("The decrypt text is : ");

de_caesar(c, shift);

system("pause"); // Comment out if you are not using windows OS

}

void de_caesar(char* c, int shift){

int i=0;

int de_caeser;

char c;

while( c[i] != '' && strlen(c)-1 > i){

de_caesarvalye = ((int)c[i] -97 - shift) % 26 + 97;

= (char)(de_caesarValue);

printf("%c", de_caesar);

i++;