A simple C program to encrypt and decrypt files using XOR encryption. The program allows users to select a file by entering its full path and provides options to encrypt or decrypt the file using a custom password (key).
✅ Encrypts any file using a user-defined key
✅ Decrypts the file with the same key
✅ Works with full file paths
✅ Supports Windows file paths with quotes ("C:\\path\\to\\file.txt")
✅ No external libraries required
The program applies XOR encryption, meaning:
- Encryption and decryption use the same function.
- If you encrypt a file twice with the same key, you get the original file back.
gcc -o file_encryption main.cgcc -o file_encryption.exe main.cRun the program from the command line:
./file_encryption1
"C:\Users\YourName\Desktop\secret.txt"
MySecretKeyOutput: C:\Users\YourName\Desktop\secret.txt.enc
2
"C:\Users\YourName\Desktop\secret.txt.enc"
MySecretKeyOutput: C:\Users\YourName\Desktop\secret.txt.enc.dec
- The same key must be used for encryption and decryption.
- If the key is lost, decryption is impossible.
- The program does not store the key for security reasons.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to submit pull requests or report issues in the GitHub repository!