Perfect secrecy with XOR & SHIFT? I have read that XOR provides perfect secrecy, when the key is perfectly random. However it's technically hard to generate truly random numbers, especially on computers, so that is why people use AES, Twofish and other cypthers.

So the conditions for using XOR are that the key has to be true random, and the keysize must be at least as big as the message.



What if we just use a very long key, to guarantee at least as much entropy as the message size?

For instance we need to encrypt 6 bits of message, then using a 32 bit pseudo random key, should have at least 6 bits of entropy in it. Or use even 512-bit key, if the RNG is very weak, to suit our needs. Then we XOR the first 6 bits. 

Now the other 26 bits are leaking out, but if the attacker doesn't know the size of the input message, then it should not be a problem.

But if the attacker does know the size of the input, then we will also shift the output bits from the right to the left by n tiles, leaving p spaces between them. Lik this:



Obviously the n and p values are also random and secret choosen by us. So we would only need to keep the XOR key, the n and the p secret.

And after 1 shift operation, the message should be perfectly secret. The XOR already provides perfect secrecy, but the shift operation also hides the needle in the haystack.

Because how can an attacker brute force the original input if he doesn't even know what cypher we are using. So randomizing the cypher parameters is what I am suggesting here.

What is your opinion, is this a viable encryption system?
Hiding which cipher you are using means violating Kerckhoff's principle. That's actually an extremely common mistake. The problem is that such a cipher becomes very hard to analyze because you have to consider all the options for an attacker to learn parts of the system.

In general we don't analyze cipher designs on this website because it is too easy to come up with a random design which is probably broken but not totally obviously so. It wastes people's time to try and attack it. Cryptographers mostly don't care about new ciphers anyway. We already have good ciphers. Exceptions are made for very specific applications.