Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C program only! ECE 175: Computer Programming for Engineering Applications Conventions: Name your C programs as huz py.c where z corresponds to the homework number

C program only!
image text in transcribed
image text in transcribed
ECE 175: Computer Programming for Engineering Applications Conventions: Name your C programs as huz py.c where z corresponds to the homework number and y corresponds to the problem number. As an example the C program for hwl problem 1 should be named as hul-ple Submission Instructions: Use the dropbox on D2L to submit the c files and a PDF of your peeudocode 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= (z + k) mod 26 , Decryption: z = (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 8i 19 u 1b = = = Similarly, the decryption of ,b follows the reverse process i:(8-3) u: (19-3) b:(1-3) mod 26-5-+/ mod 26 = 16 r mod 26 = 24 V 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 "decrypted txt". A file encrypted with k . 3 is provided with the assigment. 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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

My opinions/suggestions are valued.

Answered: 1 week ago