+1443 776-2705 panelessays@gmail.com

Are you looking for Reliable Online Writing Services? We are Here For you. Our Professional Tutors Can Handle Any Kind of Assignment. Don’t Use Plagiarized Sources. Get Your Perfect Paper Today! Click Here To Order.

Hi,I found difficulties to solve this problem. I have worked on some part of the assignment but could not move on to the rest. Any help from you is greatly appreciated.Here is the prompt of the problem:”For two thousand years, codemakers have fought to preserve secrets while codebreakers have tried their best to reveal them.” – taken from Code Book, The Evolution of Secrecy from Mary, Queen of Scots to Quantum Cryptography by Simon Singh.The idea for this machine problem came from this book.You will encrypt and decrypt some messages using a simplified version of a code in the book. The convention in cryptography is to write the plain text in lower case letters and the encrypted text in upper case letters. We will follow this convention for this machine problem. We will only encrypt/decrypt letters. Any other character will be left as is (i.e. 1 2 3 . , etc).For simplicity we will exclude the letter ‘z’ from the alphabet (see below). The method of encryption used here is a simple substitution cipher that depends on the sender and receiver of the message agreeing on a keyword, which is usually just one word that will be easy to remember. Thus the key for decrypting the message will not have to be written down and is less likely to fall into enemy hands!First, the program must read in a keyword, which will be all capital letters. The letters of the keyword must be inserted in the order in which they occur into a 5×5 two dimensional array by rows, but if a letter is repeated in the keyword it is only used once in the two-dimensional array. Then the array is filled up with the remaining letters of the alphabet in order (excluding the ‘Z’).e.g. if the keyword was PHENOMENON the array would contain the following:Next, the program will read in a series of lines containing either messages to encrypt or decrypt.A plain text message will be encrypted as follows:Each letter in the message will be found in the table, and the row and column will be noted: e.g. ‘g’ (when converted to upper case) occurs at row 2, column 1 in the above array. (Remember that indexes start at 0 in C++).It will then be encrypted by reversing the row and column values, so that ‘g’ will become the character at row 1, column 2, i.e. ‘B’ in the encrypted message.Thus if the message was “good luck” it will be encrypted as “BUUV NOQW” Spaces between words will be maintained exactly as they appear in the message.A message that is already encrypted can be decrypted using exactly the same algorithm – the only difference is that the incoming message will be in upper case and the decrypted message will be in lower case.You should process a file that contains the following:HAPPINESSD EVDEUOA XC GCERVLEWQ, FESS BC EUV OCWWAOX XLC HNUVRAV VCWWERSE hello thereD HAWWC XHARAE attack at dawnD IAAX IA NUVAR HEIIARSIMXH GRMVBAE the meeting is in san franciscoD XHMS MUPCRIEXMCU MS AUORYFXAV NSMUB XHA QAYLCRV HEFFMUASSD XHA EUSLAR XC XHA PMRSX KNASXMCU CU XHA PMUEW IEY GA XRNA CR MX IEY GA PEWSAE the answer to the first question on the final may be true or it may be falseD OCUBREXNWEXMCUS YCN IEVA MX XHRCNBH XHMS IEOHMUA FRCGWAIE advance to boardwalk, pass go and collect two hundred dollarsE make my dayE zorro is back (in town)E you ain’t nothing but a hound dogE one day a computer will weigh less than a ton — popular mechanics 1948E no computer will ever need more than 640k of memory — bill gates in the mid eightiesD YCN EMUX UCXHMUB GNX E HCNUV VCBD CUA VEY E OCIFNXAR LMWW LAMBH WASS XHEU E XCU — FCFNWER IAOHEUMOS 1948D UC OCIFNXAR LMWW ADAR UAAV ICRA XHEU 640Q CP IAICRY — GMWW BEXAS MU XHA IMV AMB HXMASE the attack will start in $”population” minutesThis file has the keyword on the first line, then a series of lines beginning with ‘E’ (for encrypt) or ‘D’ (for decrypt), then exactly one space, and then the message to be either encrypted or decrypted. The program should read these lines until it comes to the end of the file.The output should echo all the data, print out the two dimensional array as above, and print out the messages and their encoded equivalents (in either upper case (encrypting output) or lower case(decrypting output)).So the first few lines of output on the above program would be something like:keyword is HAPPINESS0 1 2 3 4———————0| H | A | P | I | N |———————1| E | S | B | C | D |———————2| F | G | J | K | L |———————3| M | O | Q | R | T |———————4| U | V | W | X | Y |———————****************************************EVDEUOA XC GCERVLEWQ, FESS BC EUV OCWWAOX XLC HNUVRAV VCWWERSdecrypts to:advance to boardwalk, pass go and collect two hundred dollars****************************************hello thereencrypts toHAWWC XHARA****************************************HAWWC XHARAdecrypts to:hello there****************************************attack at dawnencrypts toEXXEOQ EX VELU****************************************IAAX IA NUVAR HEIIARSIMXH GRMVBAdecrypts to:meet me under hammersmith bridge…….Have fun!!Requirements:1.) Break up the problem into smaller modules and get each one working before going on to the next. E.g. concentrate first on how to build the two-dimensional array from the keyword.2.) Make sure you print out your 5×5 table using the key read from the file. (I have done this in my code)Hint:C++ provides 2 useful functions called toupper and tolower. Checkout the following code to see how they get used:char c;c = tolower(‘C’);cout << c << endl;c = toupper('d');cout << c << endl;I don't quite understand how to convert my array to encrypt and decrypt the message. I think I got the logic but when it comes to converting them in actual code, I lost it. I would really appreciate if you could help me bridge my array and the encrypt and decrypt code (assuming that it is the right one, or maybe not, I have no idea since I couldn't find a way to test it.) I would really appreciate if you could help me out. Here is the source file HAPPINESSD EVDEUOA XC GCERVLEWQ, FESS BC EUV OCWWAOX XLC HNUVRAV VCWWERSE hello thereD HAWWC XHARAE attack at dawnD IAAX IA NUVAR HEIIARSIMXH GRMVBAE the meeting is in san franciscoD XHMS MUPCRIEXMCU MS AUORYFXAV NSMUB XHA QAYLCRV HEFFMUASSD XHA EUSLAR XC XHA PMRSX KNASXMCU CU XHA PMUEW IEY GA XRNA CR MX IEY GA PEWSAE the answer to the first question on the final may be true or it may be falseD OCUBREXNWEXMCUS YCN IEVA MX XHRCNBH XHMS IEOHMUA FRCGWAIE advance to boardwalk, pass go and collect two hundred dollarsE make my dayE zorro is back (in town)E you ain’t nothing but a hound dogE one day a computer will weigh less than a ton — popular mechanics 1948E no computer will ever need more than 640k of memory — bill gates in the mid eightiesD YCN EMUX UCXHMUB GNX E HCNUV VCBD CUA VEY E OCIFNXAR LMWW LAMBH WASS XHEU E XCU — FCFNWER IAOHEUMOS 1948D UC OCIFNXAR LMWW ADAR UAAV ICRA XHEU 640Q CP IAICRY — GMWW BEXAS MU XHA IMV AMB HXMASE the attack will start in $”population” minutesHere is my code so far:// CPP program for encoding the string // using classical cipher #include #include #include #include using namespace std;// Parameter 2a: create 5*5 arrayvoid keyalpha_array(){ ifstream secretcode; secretcode.open(“secretcode.txt”); //open a file to perform read operation using file object // Assign variables string alphabet = “ABCDEFGHIJKLMNOPQRSTUVWXY”; string keyword; getline(secretcode, keyword); // Append keyword with alphabet // Remove duplicate characther in variable keyword for (int a = 0; a < keyword.size(); a++) { if (keyword[a] == keyword[a + 1]) { keyword.erase(a, 1); } } //remove duplicate character in variable alphabet against keyword for (int i = 0; i < keyword.size(); i++) { for (int j = 0; j < alphabet.size(); j++) { if (keyword[i] == alphabet[j]) { alphabet.erase(j, 1); } } } keyword.append(alphabet); cout << keyword << endl; // Build 5*5 array const int row = 5; const int column = 5; char myarray[row][column]; int index = 0; for (int row = 0; row < 5; row++) { for (int column = 0; column < 5; column++) { myarray[row][column] = keyword[index]; index++; } } // Design 5*5 array { for (int column = 0; column < 5; column++) { cout << column << setw(4); } cout << endl; cout << "---------------------" << endl; for (int row = 0; row < 5; row++) { cout << row << ""; for (int column = 0; column < 5; column++) { cout << "| " << myarray[row][column] << " "; } cout << endl; cout << "---------------------" << endl; } } secretcode.close();}// Function generates the encoded text string encoder(string key){ string encoded = ""; // This array represents the  // 25 letters of alphabets  char arr[25] = { 0 }; // This loop inserts the keyword  // at the start of the encoded string  for (int i = 0; i < key.size(); i++) { if (key[i] >= ‘A’ && key[i] <= 'Y') { // To check whether the character is inserted  // earlier in the encoded string or not  if (arr[key[i] - 65] == 0) { encoded += key[i]; arr[key[i] - 65] = 1; } } else if (key[i] >= ‘a’ && key[i] <= 'y') { if (arr[key[i] - 97] == 0) { encoded += key[i] - 32; arr[key[i] - 97] = 1; } } } // This loop inserts the remaining  // characters in the encoded string.  for (int i = 0; i < 25; i++) { if (arr[i] == 0) { arr[i] = 1; encoded += char(i + 65); } } return encoded;}// Function that generates encodes(cipher) the message string cipheredIt(string msg, string encoded){ string cipher = ""; // This loop ciphered the message.  // Spaces, special characters and numbers remain same.  for (int i = 0; i < msg.size(); i++) { if (msg[i] >= ‘a’ && msg[i] <= 'y') { int pos = msg[i] - 97; cipher += encoded[pos]; } else if (msg[i] >= ‘A’ && msg[i] <= 'Y') { int pos = msg[i] - 65; cipher += encoded[pos]; } else { cipher += msg[i]; } } return cipher;}// Driver code int main(){ // Hold the Keyword  string key; key = keyalpha_array; //key = "EGOVAPBHMJQWIUCFKRSXNDLTY"; cout << "Keyword : " << key << endl; // Function call to generate encoded text  string encoded = encoder(key); // Message that need to encode  string message = "EVDEUOA XC GCERVLEWQ, FESS BC EUV OCWWAOX XLC HNUVRAV VCWWERS"; cout << "Message before Ciphering : " << message << endl; // Function call to print ciphered text  cout << "Ciphered Text : " << cipheredIt(message, encoded) << endl; //function to print out matrix keyalpha_array(); return 0;} Computer Science Engineering & Technology C++ Programming CPS 171