the new version of our program is Multi-Threaded, for compilation use:
g++ -pthread -o main_threaded main_threaded.cpp
note: compilation without pthread
option will result in undefined reference to `pthread_create' error.
contains all the permutation and expansion, required shift matrices
contains function to convert between many systems as following
permute takes the string, permutes it with the given permutation matrix in the specified size.
shift_lift takes the key, shifts it according to the number of round
XOR takes two HEX numbers and apply bitwise XOR operation
Fesitel_func apply the Feistel function to the text with the given key
key_preparation prepares the key in the beginning of each round (encryption or decryption)
DES_enc_round applies a full encryption round according to the given round number
DES_dec_round applies a full decryption round according to the given round number
The main file, in which we handle the I/O operations, and applying the full encryption / decryption
enc_block applies encryption for a 64 bit block
dec_block applies decryption for a 64 bit block
encrypt applies encryption on the full_text
decrypt applies decryption on the full_text
hex_reader reads file.hex (it was stated previously that the program should read .hex files)
The first version of the program was single threaded, such an implementation bottlenecked single thread in a long sequential functions.
In order to push the performance further and increase the utilization, we used 16 threads to perfrom all the operations just after dividing the text into more than 16 threads, from permutations, conversions and the whole ecnryption / decryption process.
The effect of the implementation was a dramatic decrease in required time, specially for CPUs with more cores.
We made a comparison between both versions