If you have a TRULY random key (in binary) and you have a text (in binary) that you want to encrypt.

Can you simple XOR the key and the text?

Is that secure?

How secure?

  • $\begingroup$ Welcome to Crypto.SE. I recommend you checked out one time pad. Then, with a basic understanding on that, try searching this site for any questions that might pop up. I hope this helps. $\endgroup$
    – rath
    Commented May 9, 2015 at 14:43
  • $\begingroup$ I have already read that and did not quite find the answer. I don't need a super fancy answer just the questions I already have written. $\endgroup$
    – Stefan
    Commented May 9, 2015 at 14:50

1 Answer 1


XORing a key and message is called a one time pad. It is perfectly secure, providing confidentiality, when used correctly. That last part is the hard part, along with finding a situation in which you only need confidentiality.

  • $\begingroup$ I think there are some conditionals that need to be added here. Not all keys will get the security you describe. $\endgroup$
    – mikeazo
    Commented May 10, 2015 at 21:45
  • $\begingroup$ Absolutely. Clearly this is an incomplete answer to an insufficient question which we all hope will be followed by additional research. $\endgroup$ Commented May 10, 2015 at 23:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.