Is it addition or xor in AES mix column?

  • Context: Comp Sci 
  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Addition Column
Click For Summary

Discussion Overview

The discussion revolves around the operations used in the AES MixColumns step, specifically whether the operation B7+4B is normal hex addition or XOR. Participants explore the confusion arising from different interpretations of these operations in the context of AES, referencing various sources and examples.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • Some participants express confusion about when to use XOR versus normal hex addition in AES, noting that both operations seem to yield the same results in certain cases.
  • One participant states that B7+4B is arithmetic addition, providing a formula involving lookup operations and overflow handling.
  • Another participant explains that arithmetic addition can produce results similar to XOR due to how binary addition handles carries, which may lead to confusion.
  • There is a discussion about how binary multiplication is performed in the context of AES, with references to shift and add operations and the merging of terms using bit-wise XOR.
  • One participant confirms a result of E3 using their method and points out an error in binary to hex conversion in a referenced source.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether B7+4B should be considered normal hex addition or XOR, with multiple competing views and interpretations presented throughout the discussion.

Contextual Notes

Some participants reference specific pages and examples from external sources, which may contain assumptions or definitions that are not universally agreed upon. The discussion highlights the complexity of operations in AES without resolving the ambiguities present.

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   Reactions: 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
22K