BinaryCompresser is a C++ project that provides file compression and decompression functionality. It uses the zlib library for compression and decompression, and offers optional encryption based on the Vernam cipher.
-
File Compression: The
file_to_binary_string
function compresses files into a binary format using zlib. It takes a path to the input file and a path to the output compressed binary file as input. It also takes an optional encryption key. -
File Decompression: The
binary_string_to_file
function decompresses files from a binary format using zlib. It takes the binary path and the output path as input, as well as an optional decryption key. -
Optional Encryption: The optional encryption is based on the Vernam cipher. If a key is provided, the
file_to_binary_string
function will encrypt the file before compression, and thebinary_string_to_file
function will decrypt the file after decompression.
You can use BinaryCompresser from the terminal as follows:
To compress a file into a binary:
./BinaryCompresser --file-to-binary <input_file_path> <output_binary_path> [key]
To retrive a file from a binary:
./BinaryCompresser --binary-to-file <input_binary_path> <output_file_path> [key]
I’ve done some performance testing on files up to 200 MBs. Here are the results:
These plots show the time taken to compress files and the size of the compressed files. As you can see, BinaryCompresser is capable of efficiently compressing large files.
This project uses CMake for building. You can build the project as follows:
mkdir build
cd build
cmake ..
make
This will create a build
directory, change into that directory, generate the Makefile with CMake, and then build the project with Make.
Contributions are welcome and greatly appreciated! To contribute to this project, follow these steps:
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/my-feature
-
Make the desired changes and commit them:
git commit -m "Add my feature"
-
Push to the branch:
git push origin feature/my-feature
-
Open a pull request in the main repository.
If you have any questions, suggestions, or feedback, please feel free to contact me:
- GitHub: github.com/hamdi3
I'm open to collaboration and look forward to hearing from you!