Score:0

Hamming distance between product and carry-less product

br flag

Motivation. There is a fast approximation to conventional multiplication. It conceptually works like long multiplication except for the fact that the carry is discarded instead of applied to the more significant position. Hence its name: carry-less product. One use is to improve the speed of applications doing block cipher encryption in Galois/Counter Mode. The operation is also known as an XOR multiplication, as carry-discarding addition is equivalent to an exclusive or.

This question is about the quality of this approximation in terms of Hamming distance.

Carry-less product. Assume we have two non-negative integers $a=\sum_{i}a_{i}2^{i}$ and $b=\sum_{i}b_{i}2^{i}$, with $a_i , b_i \in \{ 0 , 1\}$ denoting the bits of these numbers. Then the carry-less product of $a,b$ is defined to be $c=\sum_{i}c_{i}2^{i}$, with each bit $c_i$ computed as the XOR of products of bits from the input numbers as follows:

$$c_{i}=\bigoplus _{j=0}^{i}a_{j}b_{i-j}.$$

Questions. In terms of $n$, what is the maximum Hamming distance of the conventional product to the carry-less product that any $n$-bit numbers can have? And what is the average Hamming distance between the conventional and the carr-less product of $n$-bit numbers?

Mark avatar
ng flag
The carryless product seems to be precisely standard polynomial multiplication over $\mathbb{F}_2[x] \cong \mathbb{Z}[x] / (2)$. The standard product can additionally be seen as a product in $\mathbb{Z}[x] / (x -2)$ in a natural way.
pe flag
The average is difficult to obtain, but the maximum is $2n-2$, and it's not difficult to create inputs matching it.
Mark avatar
ng flag
While this doesn't precisely answer your question, BoringSSL's page on [GHASH](https://bearssl.org/constanttime.html#generic-tools) discusses how one can use standard integer multiplication to compute *exactly* the carryless product via a certain padding technique.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.