Today I went to my internship and we talked about the code I used for my One Time Pad program and things I can do to improve it.
|
One Time Pad Encryption |
Basically I start by converting the message into a bites, which is also known as one's and zero's. I then generate a random key of one's and zero's. I then compare the two strings. I then compare numbers at each position. If they are the same, it places a zero in that same position in the ciphertext. If they are different, the program puts a one in that position. The ciphertext is then printed to the screen.
|
One Time Pad Decryption
|
In order to decrypt the ciphertext, the program first compares the ciphertext with the key. Just like before if the number is the same, then it places a zero and if its different it places a one. This will give you the binary for the message. Then next step is to convert the binary to characters. After this step the program prints the original message to screen.
I am going to add a few improvements to my program. I am going to add the -e and -d commands which will allow me to control whether the program encrypts or decrypts. Right now, the program does both at the same time, which is unconventional. I also want to add a command that allows me to enter a key and ciphertext pair, and then will decrpyt the ciphertext and give me the original message.