Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C code: 1 Caesar's Cipher (70 points) The Caesar's cipher is a cryptographic method for encrypting text such that it becomes unreadable to a

In C code:

image text in transcribedimage text in transcribed

1 Caesar's Cipher (70 points) The Caesar's cipher is a cryptographic method for encrypting text such that it becomes unreadable to a party with- out access to the cryptographic key. It is named after Julius Caesar, who allegedly used it to protect messages of military significance. The encryption and decryption operations are simple shifts of the alphabet letters in a cyclic fashion. Mathematically, for a key k, the encryption and decryption are defined as: Encryption: c=(x+k) mod 26 Decryption: x = (c-k) mod 26 To illustrate the use of the Ceasar's cipher, consider the encryption of "fry" with key k-3. Letters f, r, y correspond to the 5th, 16th, and 24th letter of the alphabet (letter a being the 0th) f: (5+3) r: (16 3) y: (24+3) mod 26 mod 26 mod 26 8 i 19 u 1 b = Similarly, the decryption of i,u,b follows the reverse process i:(8-3) u: (19-3) b: (1-3) mod 26 mod 26 mod 26 5f 16r 24 y = = = NOTE: The modulo operation for negative numbers is different from the % arithmetic operator in C Write a C program that decrypts a file named "encrypted.txt" and places the decryption output to a file called "decryptedtxt". A file encrypted with k 3 is provided with the assignment. You can use it to test your decryption function. You will know when you have succeeded because the text becomes readable. In your program Ask the user to enter the decryption key Repeat the request until the right key is entered. . Display a message when file decryption is over Ask the user to enter a key to re-encrypt the file. . Re-encrypt file "decrypted.txt" and store it at "encrypted.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

What is American Polity and Governance ?

Answered: 1 week ago