Comp Sci Is it addition or xor in AES mix column?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Addition Column
Click For Summary
SUMMARY

The discussion clarifies the operations involved in the AES MixColumns transformation, specifically addressing the confusion between arithmetic addition and XOR operations. It establishes that the operation B7 + 4B is indeed arithmetic addition, which can yield the same result as XOR under certain conditions due to overflow handling. The participants reference the Network DLS PDF and an advanced encryption standard textbook, emphasizing the importance of understanding the distinction between binary addition and XOR in cryptographic algorithms.

PREREQUISITES
  • Understanding of AES MixColumns transformation
  • Familiarity with hexadecimal arithmetic
  • Knowledge of binary operations, specifically XOR and addition
  • Experience with cryptographic algorithms and their implementations
NEXT STEPS
  • Study the AES MixColumns operation in detail, focusing on arithmetic addition and XOR
  • Learn about overflow handling in binary arithmetic
  • Explore the implications of using XOR versus addition in cryptographic contexts
  • Review the Network DLS PDF for practical examples of AES operations
USEFUL FOR

Cryptographers, software developers working with encryption algorithms, and students studying advanced encryption standards will benefit from this discussion.

shivajikobardan
Messages
637
Reaction score
54
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.

https://books.google.com.np/books?i...nepage&q=advanced encryption standard&f=false
 
Physics news on Phys.org
PS another question:
1661484760188.png

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?
It is arithmetic addition.

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.
 
  • Like
Likes 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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • Sticky
  • · Replies 0 ·
Replies
0
Views
23K
  • · Replies 21 ·
Replies
21
Views
6K
  • · Replies 9 ·
Replies
9
Views
4K
  • Sticky
  • · Replies 0 ·
Replies
0
Views
18K
  • Sticky
  • · Replies 1 ·
Replies
1
Views
26K
  • Sticky
  • · Replies 0 ·
Replies
0
Views
21K