XOR cipher

XOR cipher

In cryptography, a simple XOR cipher is a relatively simple encryption algorithm that operates according to the principles:

:A oplus 0 = A,

:A oplus A = 0,

:(B oplus A) oplus A = B oplus 0 = B,

where oplus denotes the exclusive disjunction (XOR) operation. With this logic, a string of text can be encrypted by applying the bitwise XOR operator to every character using a given key. To decrypt the output, merely reapplying the key will remove the cipher.

For example, the string "Wiki" (01010111 01101001 01101011 01101001 in 8-bit ASCII) can be encrypted with the key 11110011 as follows:

:

And conversely, for decryption:

:

The XOR operator is extremely common as a component in more complex ciphers. By itself, using a constant repeating key, a simple XOR cipher can trivially be broken using frequency analysis. Its primary merit is that it is simple to implement, and that the XOR operation is computationally inexpensive. A simple XOR cipher is therefore sometimes used for hiding information in cases where no particular security is required (cf. ROT13). However, if the key is as long as the message (so it is never repeated) and its bits are random, it is in effect a one-time pad (also known as Vernam cipher), which is unbreakable, even in theory.

Also, the XOR cipher is completely vulnerable to the known-plaintext attack, since "plaintext" oplus "ciphertext" = "key".

See also

* Vernam cipher
* Vigenère cipher

External links

* [http://cryptology.dod.net/xor/xor.php Automatic XOR cipher Breaking Service]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Cipher Feedback — Mode (CFB) ist eine Betriebsart (Modus), in der Blockchiffren betrieben werden, damit Klartexte verschlüsselt werden können, die länger als die Blocklänge des Chiffrierverfahrens sind. Beispiele für Blockchiffre sind der Data Encryption Standard… …   Deutsch Wikipedia

  • Cipher Block Chaining — Mode (CBC) ist eine Betriebsart, in der Blockchiffren betrieben werden können. Vor dem Verschlüsseln eines Klartextblocks wird dieser zunächst mit dem im letzten Schritt erzeugten Geheimtextblock per XOR (exklusives Oder) verknüpft.… …   Deutsch Wikipedia

  • Cipher Feedback Mode — (CFB) ist eine Betriebsart (Modus), in der Blockchiffren betrieben werden, damit Klartexte verschlüsselt werden können, die länger als die Blocklänge des Chiffrierverfahrens sind. Beispiele für Blockchiffre sind der Data Encryption Standard (64… …   Deutsch Wikipedia

  • Cipher Block Chaining Mode — (CBC) ist eine Betriebsart, in der Blockchiffren betrieben werden können. Vor dem Verschlüsseln eines Klartextblocks wird dieser zunächst mit dem im vorhergehenden Schritt erzeugten Geheimtextblock per XOR (exklusives Oder) verknüpft.… …   Deutsch Wikipedia

  • Cipher Block Chaining — Mode d opération (cryptographie) En cryptographie, un mode d opération est la manière de traiter les blocs de texte clairs et chiffrés au sein d un algorithme de chiffrement par bloc. Chacun des modes possède ses propres atouts. Plusieurs modes… …   Wikipédia en Français

  • Reciprocal cipher — A reciprocal cipher means, just as one enters the plaintext into the cryptography system to get the ciphertext, one could enter the ciphertext into the same place in the system to get the plaintext. Sometimes also referred as self reciprocal… …   Wikipedia

  • Stream cipher attack — Stream ciphers, where plaintext bits are combined with a cipher bit stream by an exclusive or operation (xor), can be very secure if used properly. However they are vulnerable to attack if certain precautions are not followed:*keys must never be… …   Wikipedia

  • Block cipher modes of operation — This article is about cryptography. For method of operating , see modus operandi. In cryptography, modes of operation is the procedure of enabling the repeated and secure use of a block cipher under a single key.[1][2] A block cipher by itself… …   Wikipedia

  • Stream cipher — The operation of the keystream generator in A5/1, a LFSR based stream cipher used to encrypt mobile phone conversations. In cryptography, a stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher… …   Wikipedia

  • Block cipher — In cryptography, a block cipher is a symmetric key cipher operating on fixed length groups of bits, called blocks, with an unvarying transformation. A block cipher encryption algorithm might take (for example) a 128 bit block of plaintext as… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”