A Conversation for Boolean Algebra

XOR for encryption?

Post 1

Scumbag

Why is encrypting with XOR considered weak? I realise that to achieve perfect results the code has to be as long as the message, but surely if the code is long enough it is OK to loop it?


XOR for encryption?

Post 2

Martin Harper

if you loop the code, then you start to be able to see patterns, and thence work out the code.

For example, consider the case where the code is 2 bits long, and our message is made up of 1s and 0s, but suppose that it is known that 1s are much more common that 0s (the analogous case is english: 'e' is more common than 'x'). By observing the statistics of a large enough message, you could find the code.

So in order to send a message of X bits, you need a code of X bits. But if you have a secure channel for sending a code, most days you'd be better off using it to send the message.


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more