-
Clone the repository
-
make sure you have python 3.x installed
-
install required libraries: pycryptodome, matplotlib.
-
To run the chatting program
- run the following command in the a terminal:
python chat.py
- In another terminal run the following command:
python chat.py
- Port number and keys are generated and shared automatically. you should be able to send message right away.
-
To run the attack program and the analysis of encryption/decryption times, run the following command in the terminal:
python analysis.py
The program is divided into two parts: chatting and analysis. The chatting program is used to send and receive encrypted messages. The analysis program is used to perform analysis on how the number of bits (Key size) affect the key breaking process using two methods which are Prime Factorization and Brute force. The analysis program also shows the time taken to encrypt and decrypt the message as well.
The analysis shows that the time taken to break the key increases exponentially with the increase in the number of bits.
The following graph shows the time taken to break the key using prime factorization method:
Note: When using number of bits below 27 is presented only for comparison but the message will not be encrypted correctly because the key will be too small to encrypt the message.
The following graph shows the time taken to break the key using brute force method:
We can deduce that the time taken to break the key using prime factorization method is much lower than the time taken to break the key using brute force method. This is because the prime factorization search space is much smaller than the brute force search space. The prime factorization search space is limited to the number of primes less than the key. The brute force search space is limited to the number of possible keys.
Both the encryption and decryption time increases exponentially because the time taken to encrypt and decrypt the message is directly proportional to the number of bits in the key.
The following graph shows the time taken to encrypt and decrypt the message: