Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Encrypting a File's Data (You may only use the headers #include #include and #include ) 4) Required function: void encrypt_file(const std::string& filename, const std:string&

C++ Encrypting a File's Data (You may only use the headers #include #include and #include)

image text in transcribed

image text in transcribed

image text in transcribed

4) Required function: void encrypt_file(const std::string& filename, const std:string& password) You realized that someone else might see through your idea to "unzip" a file and determine it is not secure enough to transmit these files, so you thought encryption might be a better way to secure your pictures. To do some basic encryption, you have decided to take a password as an encryption key and then repeatedly XOR the file data with the password and write out this data as a new file. To accomplish this, we have to understand first how XOR works. The bitwise operation in C++ is computed using the A operator works on all primitive types. The XOR operation behaves as follows: Table 1: Truth table for XOR (source: http://www.cplusplus.com/doc/boolean/) aba b 011 00 1 !) A "bitwise" operator takes two variables and evaluates a logical operator on respective bits of the variables. Consider the following code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

=+Is there sufficient planning of the right type?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago