# Simple block cipher

I came up with this concept, which I thought would be pretty secure.

So the idea is this, you have a message $$M$$, which you split up in blocks of each 256 bits. You generate a random (pseudo-random of course) key of $$256$$ bits. You XOR the first block of $$M$$ with this key, which is also the input key for the second block, and so on. Would this be a secure scheme? My theory is that since XOR has the property that if you were given

$$Z = X \oplus Y$$

You can't extract $$X$$ nor $$Y$$ from $$Z$$

So you would have to guess every key in the 256 bit keyspace and go through this "encryption" process and see if you get some logical output.

So, would this be safe?

• @kelalaka what do you mean? – Ömer Enes Özmen Nov 22 '19 at 18:13
• This is auto key cipher.. Right? – kelalaka Nov 22 '19 at 18:14
• I never heard of an autokey cipher, but would the exact process I described be safe? For example encrypting an executable or some certificate – Ömer Enes Özmen Nov 22 '19 at 18:16
• Any encryption scheme which works (in the sense of allowing decryption with the key), and uses XOR as the only crypto primitive, is insecure. Hint: Ask yourself how you would recognize a message consisting of two blocks of zeros, from one with two blocks of English text, by looking at the ciphertext. This is a break. It goes worse: exploiting redundancy in the plaintext (such as: it contains common works) for key recovery from ciphertext only is an ages-old practice. – fgrieu Nov 22 '19 at 18:30
• Yes, it's a variant of Vigenere. – tylo Nov 22 '19 at 20:53

• However, if we XOR two consecutive blocks $$c_{i-1}\oplus c_{i}$$, we immediately get the plaintext $$m_i$$ of that block - because that is just your construction.