**Are you an EPFL student looking for a semester project?**

Work with us on data science and visualisation projects, and deploy your project as an app on top of GraphSearch.

Concept# XOR cipher

Summary

In cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates according to the principles:
A 0 = A,
A A = 0,
A B = B A,
(A B) C = A (B C),
(B A) A = B 0 = B,
For example where denotes the exclusive disjunction (XOR) operation. This operation is sometimes called modulus 2 addition (or subtraction, which is identical). 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 XOR function with the key will remove the cipher.
The string "Wiki" ( in 8-bit ASCII) can be encrypted with the repeating key as follows:
{|
| ||
|-
| ||
|-
| = || style="border-top: 1px solid black" |
|}
And conversely, for decryption:
{|
| ||
|-
| ||
|-
| = || style="border-top: 1px solid black" |
|}
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. If the content of any message can be guessed or otherwise known then the key can be revealed. Its primary merit is that it is simple to implement, and that the XOR operation is computationally inexpensive. A simple repeating XOR (i.e. using the same key for xor operation on the whole data) cipher is therefore sometimes used for hiding information in cases where no particular security is required. The XOR cipher is often used in computer malware to make reverse engineering more difficult.
If the key is random and is at least as long as the message, the XOR cipher is much more secure than when there is key repetition within a message. When the keystream is generated by a pseudo-random number generator, the result is a stream cipher. With a key that is truly random, the result is a one-time pad, which is unbreakable in theory.
The XOR operator in any of these ciphers is vulnerable to a known-plaintext attack, since plaintext ciphertext = key.
It is also trivial to flip arbitrary bits in the decrypted plaintext by manipulating the ciphertext.

Official source

This page is automatically generated and may contain information that is not correct, complete, up-to-date, or relevant to your search query. The same applies to every other page on this website. Please make sure to verify the information with EPFL's official sources.

Related publications

Loading

Related people

Loading

Related units

Loading

Related concepts

Loading

Related courses

Loading

Related lectures

Loading

Related MOOCs

Loading

Related publications

Related people

Related units

Related courses (2)

No results

Related concepts (3)

Related lectures (17)

Related MOOCs

No results

No results

COM-401: Cryptography and security

This course introduces the basics of cryptography. We review several types of cryptographic primitives, when it is safe to use them and how to select the appropriate security parameters. We detail how

COM-301: Computer security

This is an introductory course to computer security and privacy. Its goal is to provide students with means to reason about security and privacy problems, and provide them with tools to confront them.

Cryptography

Cryptography, or cryptology (from κρυπτός "hidden, secret"; and γράφειν graphein, "to write", or -λογία -logia, "study", respectively), is the practice and study of techniques for secure communication in the presence of adversarial behavior. More generally, cryptography is about constructing and analyzing protocols that prevent third parties or the public from reading private messages. Modern cryptography exists at the intersection of the disciplines of mathematics, computer science, information security, electrical engineering, digital signal processing, physics, and others.

Stream cipher

A stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream). In a stream cipher, each plaintext digit is encrypted one at a time with the corresponding digit of the keystream, to give a digit of the ciphertext stream. Since encryption of each digit is dependent on the current state of the cipher, it is also known as state cipher. In practice, a digit is typically a bit and the combining operation is an exclusive-or (XOR).

XOR cipher

In cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates according to the principles: A 0 = A, A A = 0, A B = B A, (A B) C = A (B C), (B A) A = B 0 = B, For example where denotes the exclusive disjunction (XOR) operation. This operation is sometimes called modulus 2 addition (or subtraction, which is identical). With this logic, a string of text can be encrypted by applying the bitwise XOR operator to every character using a given key.

Ancient Cryptography: Security and Information Theory

Explores ancient cryptography, key security, perfect secrecy, and the Shannon encryption model.

Cryptography: symmetric crypto

Covers symmetric cryptography, encryption algorithms, protection, stream ciphers, and AES.

Symmetric Encryption: Physical Limits

Explores the physical limits and security aspects of symmetric encryption schemes, including energy consumption, key recovery, and distinguisher security.

No results