Question: A shift cipher is one of the simplest encryption techniques in the field of cryptography. It is a cipher in which each letter in a

 A shift cipher is one of the simplest encryption techniques in

A shift cipher is one of the simplest encryption techniques in the field of cryptography. It is a cipher in which each letter in a plain text message is replaced by a letter some fixed number of positions up the alphabet (i.e. by right shifting the alphabetic characters in the plain text message). For example, with a right shift of 2, 'A' is replaced by 'C', 'B' is replaced by 'D', etc. Note that the shift wraps around from the end to the beginning of the alphabet such that, with a right shift of 2, 'Y' is replaced by 'A' and 'Z' is replaced by 'B'. Deciphering works in the same way, but shifts to the left and wraps around from the beginning of the alphabet to the end. Write two functions encrypt and decipher. encrypt takes a NULL terminated string and a shift parameter as inputs, and right shifts all alphabetic characters (i.e. 'a' - 'z' and 'A' - 'Z') by the shift parameter. Non- alphabetic characters should not be changed by encrypt. decipher takes a NULL terminated string and a shift parameter as inputs, and left shifts all alphabetic characters (i.e., 'a' - 'z' and 'A' - 'Z') by the shift parameter. Non- alphabetic characters should not be changed by encrypt. Your functions can be written assuming that the shift parameter will never be less than 0 or greater than 26. You must use the following function prototypes: void encrypt (char str[], int shift); void decipher (char str[], int shift)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!