Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Cracking an Encrypted File (You can only use the headers #include #include #include ) 5) Required function: std::string crack file(const std::string& originalFilename, const std:string&
C++ Cracking an Encrypted File (You can only use the headers
#include
#include
#include
5) Required function: std::string crack file(const std::string& originalFilename, const std:string& encryptedFilename) Your friend was using their email password to encrypt a file using your software and then later forgot their password. Fortunately, they still have the original file as well as the encrypted file created with that password. You have an idea to save the day. If you XOR each bit, pairwise, of the two files you would be able to recover the string containing (repeated copies) of the password they used to encrypt the file The function crack file should take two files and then determine the password used to encrypt the file. To complete the functionality Load each file in binary mode Compute the XOR between the two files by computing the XOR between the respective bytes of each file Determine the password used to encrypt the file . Return the string containing the password (exactly one copy of the password). You will have to think about how to process the string to find the password Assumptions you can make for crack file(... The files referred to by originalFilename and encryptedFilename exist. The files referred to by originalFilename and encryptedFilename are not empty The files referred to by originalFilename and encryptedFilename are of the same length. The password is the first repeated text that you find (so if you see "passwordpassword" the password would simply be "password" and not the repeat. If there is no repeated text, then take the entire string as the password (even if you know the password was longer). For example, suppose a file of 4 bytes was encrypted with the password "password" using our method. When you go to recover the password, you will only be able to recover "pass" (4 bytes) since not all bytes from the original password could be used You have read permission on the directory
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started