Question: Program used to encrypt and decrypt a given phrase. // Takes secret key and phrase from command line // secret key single (lower case character)
Program used to encrypt and decrypt a given phrase. // Takes secret key and phrase from command line // secret key single (lower case character) // phrase is any length // phrase encrypted using XOR with key // decrypt function test all keys // prints decrypted version to console // person inspect printout and find out what // original key is #include#include // encrypts given sentence using key using XOR // key is a single lowerchase character // Hint: strlen used to get length of C-string void encrypted(char* sentence, char key) { // codehere... printf("Encrypted: %s ", sentence); } // try all possible lower case characters as keys // print each decrypted string // Hint: store decrypted string temp variable // do not modify encryped string void decrypted(char* encrypted) { // codehere... // define key and temp // printf("For key %c, we get: %s ", key, temp); } int main(void) { // codehere... - define variable secret // secret is single lowercase character // need use fgets to read whole line // and use first character as "secret" printf("Enter secret key: "); // your CODE goes here - define variable phrase printf("Enter phrase to encode: "); // your CODE goes here // uncomment below lines when variables are defined // printf("Secret is: %c ", secret); // printf("Phrase is: %s ", phrase); // encrypted(phrase, secret); // decrypted(phrase); return 0; }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
