I'm trying to reverse an encryption scheme without success. I have several pairs of ciphertext + plaintext and found the encryption method to be something like this:

K = secret key, eg. [a,b,c,d]
P = key provided with the ciphertext, eg. [1,2,3,4]

Q = provided key bits shuffled around using each entry as an index into the secret key

N = Q concatenated with one more byte resulting from state of the previous step (so it also depends on the secret key)

O = Has the same elements as the key provided, and each element is made by bitwise OR in this fashion: ( N[i] | N[i+1] )

Then O is xored with the ciphertext to get the plaintext.

I have no experience with cryptography, and as a programmer, my first approach was to reverse the procedure and try to find the key using my ciphertext-plaintext pairs.

Obviously, the first hurdle I encountered is that I can't reverse the OR combination.

I tried looking for information and learn what kind of approach I could try to solve this problem (And even how solvable it is), but I don't even know the terminology I could use to find it.

Any hint or help about how to tackle this, what to look for or where to learn more, would be greatly appreciated.

  • $\begingroup$ The key point is here that, this cipher is like stream cipher that x-ors the keystream ( whatever it is) with the plaintext. $\endgroup$ – kelalaka Jun 21 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.