In cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates according to the principles: A \oplus 0 = A, A \oplus A = 0, A \oplus B = B \oplus A, \oplus C = A \oplus, \oplus A = B \oplus 0 = B, where \oplus denotes the exclusive disjunction operation.
Why XOR is used for encryption?
The XOR property (a xor b) xor b = a comes in handy for stream ciphers: to encrypt a n bit wide data, a pseudo-random sequence of n bits is generated using the crypto key and crypto algorithm. XOR is more subtle you can't know for sure the value of any bit of the result, whatever the mask you choose.
How safe is XOR encryption?
XOR encryption can be reasonably* strong if the following conditions are met: The plain text and the password are about the same length. The password is not reused for encrypting more than one message. The password cannot be guessed, IE by dictionary or other mathematical means.