[Help]C++ bit shifting
So I wrote a program which encrypts text using a completely different method which I now figured could be somewhat easily decrypted with a decent pc.
However I think I know of a way to use bit shifting to make it near impossible. I looked everywhere for an answer but I didn't really find one.
Basically how would you make sure to take the bit that falls off and slap it onto the next byte. The best solution I can think of is this:
say you have the value
1001 1110
you want to shift it left by 2
so you put it in a loop
loop_of_some_sort
{
1001 1110 & 1100 0000 = some_var
some_var / 64
1001 1110 * 2 = some_var2
some_var2 or some_var = some_var
}
Now you should have it shifted left by 2 and you didn't loose the bits. I threw that pseudo code together while writing this post so it might be wrong.
Does anyone know of a simpler way?
However I think I know of a way to use bit shifting to make it near impossible. I looked everywhere for an answer but I didn't really find one.Basically how would you make sure to take the bit that falls off and slap it onto the next byte. The best solution I can think of is this:
say you have the value
1001 1110
you want to shift it left by 2
so you put it in a loop
loop_of_some_sort
{
1001 1110 & 1100 0000 = some_var
some_var / 64
1001 1110 * 2 = some_var2
some_var2 or some_var = some_var
}
Now you should have it shifted left by 2 and you didn't loose the bits. I threw that pseudo code together while writing this post so it might be wrong.
Does anyone know of a simpler way?

haha wana play with the program I have for now? Simple little thing and unfortunately makes the output 2 times the size of the input due to the method I used 0.o