
The carry-less product of two
binary number
A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which uses only two symbols: typically "0" ( zero) and "1" (one).
The base-2 numeral system is a positional notati ...
s
is the result of carry-less multiplication of these numbers.
This operation conceptually works like
long multiplication
A multiplication algorithm is an algorithm (or method) to multiply two numbers. Depending on the size of the numbers, different algorithms are more efficient than others. Efficient multiplication algorithms have existed since the advent of the d ...
except for the fact that the
carry
Carry or carrying may refer to:
People
* Carry (name)
Finance
* Carried interest (or carry), the share of profits in an investment fund paid to the fund manager
* Carry (investment), a financial term: the carry of an asset is the gain or cost of ...
is discarded instead of applied to the more significant position.
It can be used to model operations over
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subt ...
s,
in particular multiplication of polynomials from GF(2)
'X''
the
polynomial ring
In mathematics, especially in the field of algebra, a polynomial ring or polynomial algebra is a ring (which is also a commutative algebra) formed from the set of polynomials in one or more indeterminates (traditionally also called variable ...
over
GF(2)
(also denoted \mathbb F_2, or \mathbb Z/2\mathbb Z) is the finite field of two elements (GF is the initialism of ''Galois field'', another name for finite fields). Notations and \mathbb Z_2 may be encountered although they can be confused with ...
.
The operation is also known as an XOR multiplication, as carry-discarding addition is equivalent to an exclusive or.
Definition
Given two numbers
and
,
with
denoting the bits of these numbers.
Then the carry-less product of these two numbers is defined to be
, with each bit
computed
as the
exclusive or
Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false).
It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , ...
of products of bits from the input numbers as follows:
:
Example
Consider ''a'' = 10100010
2 and ''b'' = 10010110
2,
with all numbers given in binary.
Then the carry-less multiplication of these is essentially what one would get
from performing a long multiplication but ignoring the carries.
1 0 1 0 0 0 1 0 = a
---------------, ---, -------, --
1 0 0 1 0 1 1 0, 0 0 0 0 0 0 0
1 0 0 1 0 1 1 0, 0 0 0 0 0
1 0 0 1 0 1 1 0, 0
------------------------------
1 0 1 1 0 0 0 1 1 1 0 1 1 0 0
^ ^
So the carry-less product of ''a'' and ''b'' would be ''c'' = 101100011101100
2.
For every bit set in the number ''a'', the number ''b'' is shifted to the left
as many bits as indicated by the position of the bit in ''a''.
All these shifted versions are then combined using an exclusive or,
instead of the regular addition which would be used for regular long multiplication.
This can be seen in the columns indicated by
^
, where regular addition
would cause a carry to the column to the left, which does not happen here.
Multiplication of polynomials
The carry-less product can also be seen as a multiplication of polynomials
over the field
GF(2)
(also denoted \mathbb F_2, or \mathbb Z/2\mathbb Z) is the finite field of two elements (GF is the initialism of ''Galois field'', another name for finite fields). Notations and \mathbb Z_2 may be encountered although they can be confused with ...
.
This is because the exclusive or corresponds to the addition in this field.
In the example above, the numbers ''a'' and ''b'' corresponds to polynomials
:
and the product of these is
:
which is what the number ''c'' computed above encodes.
Notice how
and
thanks to the
arithmetic in GF(2).
This corresponds to the columns marked
^
in the example.
Applications
The elements of GF(2
''n''), i.e. a
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subt ...
whose order is a
power of two
A power of two is a number of the form where is an integer, that is, the result of exponentiation with number two as the base and integer as the exponent.
In a context where only integers are considered, is restricted to non-negati ...
,
are usually represented as polynomials in GF(2)
'X''
Multiplication
Multiplication (often denoted by the cross symbol , by the mid-line dot operator , by juxtaposition, or, on computers, by an asterisk ) is one of the four elementary mathematical operations of arithmetic, with the other ones being ad ...
of two such field elements
consists of multiplication of the corresponding polynomials,
followed by a reduction with respect to some irreducible polynomial
which is taken from the construction of the field.
If the polynomials are encoded as binary numbers,
carry-less multiplication can be used to perform the first step of this computation.
Such fields have applications in
cryptography
Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adve ...
and for some
checksum
A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify dat ...
algorithms.
Implementations
Recent
x86 processors support the
CLMUL instruction set Carry-less Multiplication (CLMUL) is an extension to the x86 instruction set used by microprocessors from Intel and AMD which was proposed by Intel in March 2008 and made available in the Intel Westmere processors announced in early 2010. Mathema ...
and thus
provide a hardware instruction to perform this operation.
For other targets it is possible to implement the computation above as a software algorithm,
and many cryptography libraries will contain an implementation
as part of their finite field arithmetic operations.
Other bases
The definition of a carry-less product as the result of a long multiplication discarding carry
would readily apply to
bases other than 2.
But the result depends on the basis, which is therefore an essential part of the operation.
As this operation is typically being used on computers operating in binary,
the binary form discussed above is the one employed in practice.
Polynomials over other finite fields of prime order do have applications,
but treating the coefficients of such a polynomial as the digits of a single number is rather uncommon,
so the multiplication of such polynomials would not be seen as a carry-less multiplication of numbers.
See also
*
CLMUL instruction set Carry-less Multiplication (CLMUL) is an extension to the x86 instruction set used by microprocessors from Intel and AMD which was proposed by Intel in March 2008 and made available in the Intel Westmere processors announced in early 2010. Mathema ...
, an
x86 ISA extension
*
Finite field arithmetic In mathematics, finite field arithmetic is arithmetic in a finite field (a field containing a finite number of elements) contrary to arithmetic in a field with an infinite number of elements, like the field of rational numbers.
There are infinit ...
*
Galois/Counter Mode
In cryptography, Galois/Counter Mode (GCM) is a mode of operation for symmetric-key cryptographic block ciphers which is widely adopted for its performance. GCM throughput rates for state-of-the-art, high-speed communication channels can be achie ...
References
{{reflist
Binary arithmetic
Computer arithmetic
Multiplication