This project implements three approaches to brute-force decrypting a DES-encrypted text. The three approaches include:
- Naive (Sequential): Performs the search sequentially, testing all possible key combinations until the correct one is found.
- First Approach (Parallel with MPI): Divides the keyspace among multiple processes using MPI, allowing parallel key testing.
- Second Approach (Optimized with MPI): Improves on the first approach by testing two keys simultaneously in each iteration, reducing the number of iterations needed.
- GCC: For compiling the naive approach.
- MPICC (OpenMPI): For compiling the parallel approaches.
- OpenSSL: Library to handle DES encryption and decryption.
- Compilation:
gcc -o naive naive.c -lssl -lcrypto
- Execution:
./naive <file_to_decrypt> <initial_key> <search_file>
- Compilation:
mpicc -o approach1 firstApproach.c -lssl -lcrypto
- Execution:
mpirun --allow-run-as-root -np <number_of_processes> ./approach1 <file_to_decrypt> <initial_key> <search_file>
- Compilation:
mpicc -o approach2 secondApproach.c -lssl -lcrypto
- Execution:
mpirun --allow-run-as-root -np <number_of_processes> ./approach2 <file_to_decrypt> <initial_key> <search_file>
- File to decrypt (
string.txt_
): The file that contains the encrypted text to be decrypted. - Search file (
search.txt
): The file containing the known text to search for within the decrypted text (used as a known substring).
When executing any of the approaches, the program will print:
- The correct key used to decrypt the file.
- The original text and encrypted text.
- The execution time of the process.