Week 8 – Data Collection (With a Pinch of Torment)
Aadit R -
Alright, week eight. So, I have quite a few things to cover. First, I changed my generate files function to store a string that is 128 bytes long instead of 100 bytes, so that the calculation results in 1024 bytes per input size, so now the resulting files should be in kilobytes (128*8 = 1024 bytes = 1 kilobyte) rather than in 1000 bytes. I also wrote a second function to create files given a size in bytes rather than kilobytes, since the asymmetric algorithms I plan to test (RSA and ElGamal) are not meant for encrypting large sizes. Also, I could’ve made the function a lot simpler by having it generate a string with random bytes of a given size rather than copying the same string of a fixed length a given number of times, but, as a personal preference, I decided to make the file more “readable” and not use arbitrary bytes (plus it also makes checking to see if the decryption algorithm works properly a lot easier since the text in the output file is not a random string of characters).
I also polished my AES and RSA implementations by making data collection and performing multiple trials more convenient. Here is a snippet of one of the trials I ran for RSA:

And here is a snippet for AES:

The times are in seconds, and the file sizes are in bytes. I ran each implementation five times, with the same file size but different key sizes, and had the program output the encryption and decryption times as well as the unencrypted and encrypted file sizes during each run. For the RSA implementation, I also included the time it took to generate the keys for each run, since the key generation algorithm plays a big role in RSA, while for AES, it’s just a randomly generated n-bit long number. Now, I know that the output doesn’t look clean, but it works and it prints the necessary data, so I would consider this program a success. At last, the hard part of learning how to use the library is over, and all I need to do now is make some bar graphs and compare the results, after gathering the results of these tests with different file sizes.
Finally, I also implemented the ElGamal encryption algorithm, which took a lot longer than I had anticipated, since the documentation from the library I was using only included the functions for key generation and didn’t mention the encryption/decryption processes I needed to call to use the key. So, I had to find the source code to locate the function names, and also changed one of the lines for the key generation algorithm to make generating the public and private keys more efficient (albeit less “secure”), since it was taking well over a couple of hours just to generate one 3072 bit key. Anyways, after I got all that to work, I ran the algorithm (like for the AES and RSA implementations) and got this result:

This all took an extremely long amount of time (reading the documentation, implementing the code, fixing the bugs, waiting for the keys to generate), but at least most of the work is now complete. Now all that’s left to do is repeat these tests with more files of different sizes, tidy up the data, and write one more symmetric encryption algorithm to compare with AES, after which I should be able to start on the presentation. Should be a breeze…
