Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help to answer the following C++ coding questions There is full PDF assig

ID: 3886866 • Letter: P

Question

Please help to answer the following C++ coding questions

There is full PDF assignment link:

https://drive.google.com/file/d/0B71aPXjwn2AZZjRzVi1QRDI1NUE/view?usp=sharing

handout file link:

https://drive.google.com/file/d/0B71aPXjwn2AZbzlOaS05dVVabzA/view?usp=sharing

Please only help with those questions in the assignment, I will rate the answer, please do it seriously.

1) (1.5 point each, 6 total) Suppose a file named "letters" contains the following characters: aabbccddeeffgghhiijjkkll a. What is the name of the file created by the function call unzip file("letters"); b. Write the contents of the file written by the function call unzip file("letters"); c. What is the name of the file created by the function call zip file("letters"); d. Write the contents of the file written by the function call zip file("letters") (2 points) Compute the bitwise XOR between 10010100 and 11191010. (2 points) Suppose you are looking at the byte at index byte_pos in the file you are encrypting in a call to encrypt_file. Assuming std::string password stores the password you are using to encrypt, write the line of code to get the respective character to XOR with the current byte. 2) 3)

Explanation / Answer


Please find the answers below:
(1)
  
a. The name of the file after the function call unzip_file("letters") : "letters-unzipped"
b. The contents of the file after the function call unzip_file("letters") : aabbeeffiijjccddgghhkkll
c. The name of the file after the function call zip_file("letters") : "letters-unzipped-zipped"
d. The contents of the file after the function call zip_file("letters") : aabbccddeeffgghhiijjkkll

  
(2)
Bitwise XOR between 10010100 and 11101010 is as follows:


1 0 0 1 0 1 0 0
1 1 1 0 1 0 1 0
-------------------------

0 1 1 1 1 1 1 0


(3)
Below is the code to encrypt each character at byte at index byte_pos with password string.

ifstream inFile;
inFile.open( fileName); // read file with ifstream
inFile.seekg(byte_pos, ios::beg); // go to byte at byte_pos
data = new char[8];
inFile.read( oData, 8 ); // read byte in char array
for (int i=0; i<8 i++)
{
data[i] = data[i] ^ password[i]; // XOR each character with respective char in password string
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote