# Understanding Weird Relationship Between Hamming Weights

I have two binary "mapping" matrices $$\delta_0$$ and $$\delta_1$$

$$\delta_0 = \begin{bmatrix} 1 0 1 0 0 0 0 0\\ 1 1 0 1 1 1 1 0\\ 0 0 0 0 1 1 0 0\\ 0 1 1 1 0 0 0 0\\ 0 1 1 0 1 0 0 0\\ 1 0 0 1 1 1 0 0\\ 0 0 1 1 0 1 0 0\\ 0 0 0 0 0 0 1 1\\ \end{bmatrix}$$

$$\delta_1 = \begin{bmatrix} 1 0 1 0 0 0 1 0\\ 1 1 0 1 0 0 0 0\\ 0 0 0 0 0 0 1 0\\ 1 0 1 0 1 1 1 0\\ 0 0 0 1 0 1 0 0\\ 1 0 0 0 0 1 0 0\\ 0 0 0 1 0 0 1 0\\ 0 1 1 1 0 1 1 1 \end{bmatrix}$$

The least significant bit is in the bottom right. The most significant bit is in the top left.

Their purpose is to map binary values in a finite field GF($$2^8$$) into another. This involves multiplying each possible element by each matrix.

I map the elements 0-255 for both matrices. Computed using $$\delta_i\times x$$ mod 2 for $$x$$ 0-255 in binary. I know have two matrices which contain 256 "mapped" values.

I take the a hamming weight of each mapped value. This computes the number of '1' bits in each mapped entry. I keep it in order.

I then take the co-variance of the hamming weights and I find it equals zero.

Ok, that particular order results in a covariance zero.

But now I keep the hamming weight array of $$\delta_0 \times x$$ mod 2 the same. And for the second mapping I do $$\delta_1 \times (x\oplus c)$$ mod 2. Where $$c$$ is a constant 8 bit value and $$\oplus$$ is the XOR operator. I take the hamming weight of these mapped values.

I calculate the co-variance of the hamming weight arrays and it is zero again. For every possible 8 bit value of $$c$$ I find the co-variance is zero.

Adding a constant $$r$$ doesn't change the distribution of the hamming weights but I would expect the co-variance to change now that the order is different.

I am kind of lost why the co-variance remains zero. I believe that co-variance is heavily dependent on order, so I assume that add $$c$$ would change the order enough to cause the co-variance to fluctuate. Is there something I m missing?

• Elements of finite fields don't have least significant or most significant bits. And I don't understand how $GF(256)$ fits into this scheme at all. All I see is two 8x8 matrices with entries in $GF(2)$. Sure you can multiply (from the left) 8x1 column vectors of bits with those matrices, and calculate some correlations. But what does any of that to do with $GF(256)$? You lost me somewhere. – Jyrki Lahtonen Mar 12 at 7:41
• If the matrices are invertible, then going through all the numbers $0-255$ will simply shuffle them; adding $c$ will not make any difference. The covariance is the sum of products over all the numbers, hence it is the same in both cases. – Chrystomath Mar 12 at 11:02
• Sorry they are elements in $GF(2^8)$ I edited my question – jackana3 Mar 12 at 12:07