This lab is supposed to be done in C, so if anyone could help using that language it would be greatly appreciated. Thnak you!!!!
Problem: Caesar Implement a program that encrypts messages using Caesar's cipher, per the below. $ ./caesar 13 plaintext: HELLO ciphertext: URYYB Background Supposedly. Caesar (yes, that Caesar) used to "encrypt" (ie..conceal in a reversible way) confidential messages by shifting each letter therein by some number of places For instance, he might write A as B. B as C. Cas D...., and, wrapping around alphabetically, Z as A. And so, to say HELLO to someone, Caesar might write IFMMP. Upon receiving such messages from Caesar, recipients would have to "decrypr them by shifting letters in the opposite direction by the same number of places The secrecy of this "cryptosystem" relied on only Caesar and the recipients knowing a secret, the number of places by which Caesar had shifted his letters (e.g. 1). Not particularly secure by modern standards, but, hey, if you're perhaps the first in the world to do it pretty securel Unencrypted text is generally called plaintext.Encrypted text is generally called Ciphertext. And the secret used is called a key. plaintext H E L o + key 1 1 = ciphertext FM M More generally, Caesar's algorithm (i.e., cipher) encrypts messages by "rotating each letter by k positions. More formally, if p is some plaintext(e, an unencrypted message). pris the in character in p, and kis a secret key fie., a non-negative integer). then each letter, c, in the ciphertext, c, is computed as C=(pi+k)mod26 wherein mod26 here means "remainder when dividing by 26." This formula perhaps makes the cipher seem more complicated than it is, but it's really just a concise way of expressing the algorithm precisely Specification Design and implement a program, caesar, that encrypts messages using Caesar's cipher. Your program must accept a single non-negative integer. Let's call it k for the sake of discussion . Do not assume that k will be less than or equal to 26. Your program should work for all non-negative integral values of k less than 23-26. In other words, you don't need to worry if your program eventually breaks if the user chooses a value for k that's too big or almost too big to fit in an int. (Recall that an int can overflow.) But, even if k is greater than 26, alphabetical characters in your program's input should remain alphabetical characters in your programs output. For instance, if kis 27, A should not become even though I is 27 positions away from A in ASCII, per ascichart.com; A should become , since Bis 27 positions away from A, provided you wrap around from z to Your program must output plaintext: (without a newline) and then prompt the user for a string of plaintext Your program must output ciphertext: (without a newline) followed by the plaintext's corresponding ciphertext, with each alphabetical character in the plaintext "rotated" by k positions; non-alphabetical characters should be outputted unchanged. Your program must preserve case: capitalized letters, though rotated, must remain capitalized letters; lowercase letters, though rotated, must remain lowercase letters. After outputting ciphertext, you should print a newline. Your program should then exit by returning o from main. Walkthrough https://www.youtube.com/watch?v=V2uusmy2wxI&feature=emb_logo Usage Your program should behave per the examples below. Assumed that the underlined text is what some user has typed. $ ./ caesar 1 plaintext: HELLO ciphertext: IFMMP $ ./caesar 13 plaintext: hello, world ciphertext: uryyb, jbeyg $ ./caesar 13 plaintext: be sure to drink your Ovaltine ciphertext: or ther gb gevax lbhe Binygvar $ ./caesar Usage: ./caesark $/caesar 1 2 3 4 5 Usage: ./caesar k Hints The user will enter in plaintext and the shift value Once you have both k and some plaintext, p, it's time to encrypt the latter with the former. Recall that you can iterate over the characters in a string, printing each one at a time with code like the below: for (int i = 0, - strlen(p); i
<>