Please help to answer the following C++ coding questions There is full PDF assig
ID: 3886241 • 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
1. a) if input file is "letters", output file will be "letters-unzipped".
b) for input aabb ccdd eeff gghh iijj kkll, The output data will be aabb eeff iijj ccdd gghh kkll
c) if input file is "letters", output file name will be "letters-zipped"
d) for input aabb ccdd eeff gghh iijj kkll, The output data will be aabb gghh ccdd iijj eeff kkll
2. XOR result of 10010100 and 11101010 will be 01111110.
3. char result = password[byte_pos % len(password)] XOR data[byte_pos],
So password[byte_pos % len(password)] is the code which need to be XORed with the current byte data[byte_pos]
The lenght of the password is given by len(password), we take the byte_pos % len(password) because the password will be a smaller string compared to the message and hence the password need to be repeated for completely encrypting the message.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.