# Is it addition or xor in AES mix column?

• Comp Sci
• shivajikobardan
In summary, the conversation discusses the confusion between using XOR and arithmetic addition in the AES algorithm. The use of XOR and arithmetic addition in binary and hexadecimal forms is explained, along with examples of each operation. A mistake in the conversion from binary to hexadecimal is also pointed out.
shivajikobardan
Homework Statement
XOR or normal hexa addition in AES?
Relevant Equations
None
https://www.networkdls.com//Articles/AESbyExample.pdf

I'm confused because there are lots of XOR in this case. And I am not very technically aware when we'd XOR vs when we'd add. I just follow the guidelines given in standards. But here I got confused in page 9 of that pdf. When we do B7+4B, is it normal hex addition or XOR? Because both are giving same results. I tried for some of my other examples, and they were giving same results. I think it's normal hex addition, but I'm not 100% sure about that.

I was studying the below book and thus. It is not saying that's wrong, but it uses lots of XOR. So, it got me confused.

PS another question:

I'm getting the result as E3 using my networkdls pdf method. Can you check the results?

shivajikobardan said:
When we do B7+4B, is it normal hex addition or XOR? Because both are giving same results.
⊕ is a binary EXOR operation.
+ is a binary OR operation.
Those operations can be executed on wide bit-streams in parallel.

+ is also an arithmetic addition operation on a registers of bits.
There is no arithmetic addition of data in the DES algorithm.

When you process bits one by one, the arithmetic binary add will perform an EXOR of the two input LSBs, with the result placed in the output LSB. That is how binary addition is done. But when the arithmetic addition operation generates carry from the LSB, it will probably corrupt some higher bits. I expect that is why your arithmetic LSB seems to produce the same result as your EXOR.

Baluncore said:
⊕ is a binary EXOR operation.
+ is a binary OR operation.
Those operations can be executed on wide bit-streams in parallel.

+ is also an arithmetic addition operation on a registers of bits.
There is no arithmetic addition of data in the DES algorithm.

When you process bits one by one, the arithmetic binary add will perform an EXOR of the two input LSBs, with the result placed in the output LSB. That is how binary addition is done. But when the arithmetic addition operation generates carry from the LSB, it will probably corrupt some higher bits. I expect that is why your arithmetic LSB seems to produce the same result as your EXOR.
Can you give example of each operation you told(in hexa form)? I'm ofc aware of all of them, but I'm trying to understand about your answer. It's not clear what this one is based on the answer. Instead, I'm now more confused.

shivajikobardan said:
But here I got confused in page 9 of that pdf. When we do B7+4B, is it normal hex addition or XOR?

Given two bytes, a and b, compute the output c.
L(a) and L(b) are 8 bit lookup operations in the L() table.
h'FF is the hexadecimal constant "FF".

sum = L(a) + L(b) ; where “+” is an arithmetic addition that can overflow.
If sum > h'FF then sum = sum - h'FF ; where "-" is arithmetic subtraction.
c = E( sum ) ; lookup the result in table E() ; Note:
There is a simple way to handle the addition overflow without needing to test for overflow. In a byte, because h'FF is the same as -1, arithmetic subtraction of h'FF is the same as addition of h'01.
You can arithmetically add the two 8 bit bytes, giving a 9 bit result in a 16 bit register. The high byte will have a value of h'00, or h'01 if the addition overflowed.
Simply add the high and low bytes to make a one byte result.

shivajikobardan said:
I'm getting the result as E3 using my networkdls pdf method. Can you check the results?
(1*36)⊕(2*b9)⊕(3*a5)⊕(3*38) = (1*h'36)⊕(2*h'b9)⊕(3*h'a5)⊕(3*h'38)

This is performing arithmetic multiplication "*" by constants of 1, 2 or 3.
Binary multiplication can be seen as a shift and add operation.
(1 * x) = x
(2 * x) = x + x = (x shifted left one bit). Where "+" is arithmetic addition.
(3 * x) = x + x + x = x + (x shifted left one bit).

Once the arithmetic addition is done, the 4 terms are merged using bit-wise EXOR.

You are correct; b'1110 0011 = h'E3.
They make an error in the binary to hex conversion in the last line.

shivajikobardan
Baluncore said:
(1*36)⊕(2*b9)⊕(3*a5)⊕(3*38) = (1*h'36)⊕(2*h'b9)⊕(3*h'a5)⊕(3*h'38)

This is performing arithmetic multiplication "*" by constants of 1, 2 or 3.
Binary multiplication can be seen as a shift and add operation.
(1 * x) = x
(2 * x) = x + x = (x shifted left one bit). Where "+" is arithmetic addition.
(3 * x) = x + x + x = x + (x shifted left one bit).

Once the arithmetic addition is done, the 4 terms are merged using bit-wise EXOR.

You are correct; b'1110 0011 = h'E3.
They make an error in the binary to hex conversion in the last line.
oh thank you.

## 1. What is the purpose of the Mix Column step in AES?

The Mix Column step in AES is used to provide diffusion and confusion in the cipher. It helps to prevent patterns from being preserved in the ciphertext, making it more difficult for attackers to decrypt the message.

## 2. How does the Mix Column step work in AES?

The Mix Column step takes each column of the state matrix and performs a matrix multiplication with a fixed matrix. This process mixes the bytes within each column and results in a more randomized state matrix.

## 3. Is the Mix Column step in AES an addition or xor operation?

The Mix Column step in AES is a combination of both addition and xor operations. It involves multiplying each byte in a column by a fixed matrix, which involves both addition and xor operations.

## 4. What is the difference between addition and xor in the Mix Column step of AES?

Addition and xor are both used in the Mix Column step to provide different types of diffusion. Addition helps to spread out the bits within a column, while xor helps to mix the bits together. This combination of operations results in a more secure cipher.

## 5. Why is the Mix Column step necessary in AES?

The Mix Column step is necessary in AES to provide a higher level of security. Without this step, the cipher would be more vulnerable to attacks, as patterns and relationships between bytes could be easily identified. The Mix Column step adds an extra layer of diffusion and confusion, making it more difficult for attackers to break the cipher.

Replies
3
Views
2K
Replies
21
Views
2K
Replies
2
Views
3K
Replies
1
Views
20K
Replies
14
Views
4K
Replies
8
Views
2K
Replies
9
Views
4K
Replies
1
Views
16K
Replies
1
Views
23K
Replies
1
Views
19K