Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

are you able to create the program using the images below. F2021 CST8234 C Programming Due Date: October 3rd, 2021 (23:59) Lab 02: To perform

are you able to create the program using the images below.

image text in transcribedimage text in transcribedimage text in transcribed
F2021 CST8234 C Programming Due Date: October 3rd, 2021 (23:59) Lab 02: To perform Data Cryptography and Decryptography Note: Students must demonstrate their lab on either October 6'\" or 7th, 2021 to get the grade. This lab is worth ZOmarks. A Missed demonstration will result in 100% grade deduction. Late submission is not allowed. You must talk to me in advance in case of any unprecedented situation which may result in late submission. Setup: 1. Use the directory created earlier. You are going to develop your lab here. Caesar Cipher One of the simplest examples of a substitution cipher is the Caesar cipher, which is said to have been used by Julius Caesar too communicate with his army. Caesar is considered one of the first persons to have every employed encryption for the sake of securing messages. Caesar decided that shifting each letter in the message would be his standard algorithm, and so informed all of his generals of his decision and was then able to send them secured messages. Use the Caesar Shift, with a rotation value of 3, the message "Return to Rome!" would be encrypted as "thxuq wr Urph!\". In this example, 'R' is shifted to 'U', 'e' is shifted to 'h' and so on. Now, even if the enemy did intercept the message, it would be useless, since only Caesar's generals could read it. Only alphabetic characters encrypted (respecting upper and lowercase): a, b, c, A, B, C, etc. All other symbols are ignored. For example, numbers (1, 2, 3, etc.) and punctuation symbols (N, l, @, it, 5, etc.) are all ignored. Resources - #include o #include 0 [Wikipedia] htt s: en.wiki edia.or wiki Caesar ci her 02 CST8234 Net Cryptography lab 02 'l I 3 F2021 CST8234 C Programming Due Date: October 3rd, 2021 (23:59) Program #1: Write a small C program cc_crypto.c that: 1) Ask the user to input a message to be encrypted 2) Read the message. The message cannot exceed 80 characters. 3) If the message is more than 80 characters, it should print a message to the end user \"Invalid number of digits" and terminate with an exit value of EX|T_FAILURE 4) Prompt the user for a rotation key. Read the integer number for the rotation key. 5) Validate the key's value: must be in the range 0 to 26 (inclusive). 6) If the key is invalid, print an error message and re-prompt the User for the key. 7) If the key is valid, Your program should encrypt the message using the rotation key, following the Caesar cipher encryption algorithm given above. 8) At the end, your program should print the encrypted number and terminate with a value of EXIT_SUCCESS. The following demonstrates the run-time behavior of the program: -/cc_crypto Enter message to encrypt: Return to Rome! Enter rotation key: 3 Encrypting message (key 2 3): Return to Rome! thxuq wr Urphl Jeegrypto Enter message to encrypt: Remember to validate key's value. Enter rotation key: abc Error ~ key must be in range 0 and 26. Try again. Enter rotation key: 1 Error key must be in range 0 and 26. Try again. Enter rotation key: 27 Error key must be in range 0 and 26. Try again. Enter rotation key: 0 Encrypting message (key = 0): Remember to validate key's value. CST8234/# echo $ O CST8234/ SAMPLE msm OUTPUT: cc_crypto 02 CST8234 Net Cryptography lab 02 2 I 3 F2021 CST8234 - C Programming Due Date: October 3rd, 2021 (23:59) Program #2: Copy your cc_crypto.c to a new program decrypt.c. Your decrypt program should be able to decrypt an encrypted message using a rotation key. s: . /decrypt Enter message to decrypt: Uhwxuq wr Urph! Enter rotation key: -1 Error - key must be in range 0 and 26. Try again. Enter rotation key: 27 Error key must be in range 0 and 26. Try again. Enter rotation key: 3 Decrypting message (key = 3) : Uhwxuq wr Urph! Return to Rome ! desktop@bahris : CST8234/# echo $? 0 CST8234/ SAMPLE TEST OUTPUT: decrypt To successfully complete these programs and obtain all the marks, you will need to: 1) Use the macros EXIT_FAILURE and EXIT_SUCCESS define in the library stdlib.h to indicate unsuccessful or successful termination of your program 2) Define MAX_MSG as a macro in your program and it should be defined as 80. 3) Your program should be compiled with the flags -Wall -ansi -pedantic Marking: This lab is out of 20 points: . 10 points for cc_encrypt.c 05 for coding correctness (i.e., correct results) and compliance to "Assignment Submis- sion Standard" > 05 for demonstration during scheduled lab 10 points for cc_decrypt.c . 05 for coding correctness (i.e., correct results) and compliance to "Assignment Submis- sion Standard" > 05 for demonstration during scheduled lab Submission: . Code (.c file) -> Compressed Zip folder . Screenshots (terminal: a) gcc -ansi -pedantic -Wall and b) input(s)/output(s)) Compressed Zipfolder) . Demonstration is mandatory. A missed demonstration will result in 100% deduction. 02_CST8234_Net_Cryptography - lab 02- 3 / 3

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions