I'm trying to XOR decrypt a cyphertext with a known plaintext.
the plaintext size is 256bit, the key is 64bit and the cyphertext is huge with >16000 bits. I'm suppose to find the key and this is my code. I have some problems running this, it keep telling me stack overflow and i dont know how to solve it. Please help!!! Thanks in advance
Known plaintext was encrypted using a simple xor mechanism, you're trying to find the original key correct?
(in other words, for me to recreate your problem I need to create a plaintext file then encrypt it)
(If this is for a cryptography lesson, how far have you gotten, do we include advanced techniques in the situation? Salt? Is it a moving key or just a static repeating key?)
(edit 2: if you would like to include a link to the plaintext and encrypted file that could possibly be useful, though not strictly necessary)
Yes, I'm trying to find the original key.
I'm doing this for an assignment in c++ data structure course.
I try to put every bit of the cypher text into a linked list and try to XOR it with the plain text, if the key is repetitively matched (4time because key is 64 bits and plain text is 256) then it is found. If it is matched, the program will delete the head of the linked list and move on to the next one.
here is cipher text file and plain text file. http://www.mediafire.com/download/mxr8nx7n83lrtlt/ciphertext4.txt http://www.mediafire.com/download/rh3sy3s5v4c1m44/known+plaintext+fragment4.txt
I'm just curious, why is the cipher text 16000+ bits when the plain text is only 256? Shouldn't they be the same length? Or is it that once you figure out the key using the first 256 bits, you need to decode the rest of the cipher text?
The message(16000+bits) is encrypted but we only know a piece of the outcome which is 256bits and the key to encrypt is unknown but for sure it's 64bits (so the message ^ plaintext = 4 time keys). The key is repeated 4 times to come up with 256bits.
The catch is we don't know which part of the message is the plaintext.
For example: let plaintext is 8bits and key is 4.
1 0 1 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0 Message
0 1 1 0 1 0 1 1 Plaintext
-------------------
1 1 0 0-1 1 1 1 <- Wrong KEY