Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update exclusive-or.rst #382

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/exclusive-or.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ Exclusive or
Description
~~~~~~~~~~~

Exclusive or, often called “XOR”, is a Boolean [#boolean]_ binary [#binary]_ operator
that is true when either the first input or the second input, but not
Exclusive also known as “XOR” is a Boolean [#boolean]_ binary [#binary]_ operator.
XOR is true when either the first input or the second input, but not
both, are true.

Another way to think of XOR is as something called a “programmable
inverter”: one input bit decides whether to invert the other input bit,
or to just pass it through unchanged. “Inverting” bits is colloquially
called “flipping” bits, a term we'll use often throughout the book.
XOR can be thought of as a “programmable
inverter.” One input bit decides whether to invert another input bit,
or to pass it through unchanged. “Inverting” bits is colloquially
called “flipping” bits. Flipping bits is a term we use often throughout the book.

.. figure:: Illustrations/XOR/ProgrammableInverter.svg
:alt: a programmable inverter
:align: center

In mathematics and cryptography papers, exclusive or is generally
represented by a cross in a circle: :math:`\xor`. We'll use the same
In mathematics and cryptography papers, exclusive or XOR is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks incorrect. The or here is part of the term "exclusive or", it is not used in a conjunctive sense here.

represented by a cross in a circle: :math:`\xor`. We use the same
notation in this book:

.. figure:: Illustrations/XOR/XOR.svg
:align: center
:alt: XOR

The inputs and output here are named as if we're using XOR as an
The inputs and outputs are named as if XOR is an
encryption operation. On the left, we have the plaintext bit
:math:`P_i`. The :math:`i` is just an index, since we'll usually deal
:math:`P_i`. The :math:`i` is an index, since we will usually deal
with more than one such bit. On top, we have the key bit :math:`k_i`,
that decides whether or not to invert :math:`P_i`. On the right, we have
the ciphertext bit, :math:`C_i`, which is the result of the XOR
Expand All @@ -42,9 +42,9 @@ operation.
A few properties of XOR
~~~~~~~~~~~~~~~~~~~~~~~

Since we'll be dealing with XOR extensively during this book, we'll take
a closer look at some of its properties. If you're already familiar with
how XOR works, feel free to skip this section.
Lets take a closer look at the properties of XOR since
we deal with it extensively in this book. Feel free to skip this section
if you are already familiar with XOR.

We saw that the output of XOR is 1 when one input or the other (but not
both) is 1:
Expand All @@ -56,7 +56,7 @@ both) is 1:
0 \xor 1 = 1 & 1 \xor 1 = 0
\end{array}

There are a few useful arithmetic tricks we can derive from that.
A few useful arithmetic tricks can be derived from this.

#. You can apply XOR in any order:
:math:`a \xor (b \xor c) = (a \xor b) \xor c`
Expand Down