Program Used Encrypt Decrypt Given Phrase Takes Secret Key Phrase Command Line Secret Key Q43876387
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 <stdio.h>#include <string.h>// encrypts given sentence using key using XOR// key is a single lowerchase character// Hint: strlen used to get length of C-stringvoid encrypted(char* sentence, char key) { // codehere… printf(“Encrypted: %sn”, sentence);}// try all possible lower case characters as keys// print each decrypted string// Hint: store decrypted string temp variable// do not modify encryped stringvoid decrypted(char* encrypted) { // codehere… // define key and temp // printf(“For key %c, we get: %sn”, 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: %cn”, secret); // printf(“Phrase is: %sn”, phrase); // encrypted(phrase, secret); // decrypted(phrase); return 0;}
Expert Answer
Answer to Program used to encrypt and decrypt a given phrase. // Takes secret key and phrase from command line // secret key sing…
OR