This C++ program provides a simple file encryption and decryption tool using XOR encryption.
-
Compile the Program:
g++ EncryptionDecryptionTool.cpp -o EncryptionDecryptionTool
-
Run the Program:
./EncryptionDecryptionTool
-
Choose Operation:
- Enter
1
to encrypt a file. - Enter
2
to decrypt a file.
- Enter
-
Enter File Details:
- Enter the input file name.
- Enter the output file name.
- Enter the encryption/decryption key.
-
Example:
File Encryption/Decryption Tool 1. Encrypt 2. Decrypt Enter your choice: 1 Enter input file name: input.txt Enter output file name: encrypted_output.txt Enter encryption/decryption key: my_secret_key
-
Output:
- The program will display a success message after encryption or decryption.
- If there is an error opening the files, an error message will be displayed.
- If an invalid choice is entered, an error message will be shown.
- The program uses XOR encryption with a provided key for both encryption and decryption.
- Make sure to remember the encryption key for later decryption.
To run this program:
- Make sure you have a C compiler installed on your computer.
- Copy the code into a file with a
.cpp
extension, for example,EncryptionDecryptionTool.cpp
. - Open a terminal or command prompt and navigate to the directory where your file is located.
- Compile the program by entering:
g++ EncryptionDecryptionTool.cpp -o EncryptionDecryptionTool
- Run the compiled program:
./EncryptionDecryptionTool
Or you can run this program also using:
make EncryptionDecryptionTool