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

a. To make sure you understand the problem, we can do a hand example. For a shif

ID: 2291351 • Letter: A

Question

a. 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!

b.Write the algorithm for a function to decrypt a single character given the character and an arbitrary shift amount.

c.Translate your algorithm into C by writing the function de caesar(). The prototype is:

char de_caesar(char c, int shift);

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 For example, with a shift of 3, the letter B' would be encoded as ?,, 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; all 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

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.

#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++;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote