Score:1

Why AES code is working even with 3 Rows

si flag

First of all, I am a student, so even if most of you think it is a useless question, don't dishearten me as it is a platform for me to learn I am using an AES code that has 3 Rows and 4 columns in its Shift Rows. Although I know in AES we have 4 rows and 4 column block. Then why is it working, I am not able to understand that. Here is the code attached:

def shift_rows(s):
    s[1][0], s[1][1], s[1][2], s[1][3] = s[1][1], s[1][2], s[1][3], s[1][0]
    s[2][0], s[2][1], s[2][2], s[2][3] = s[2][2], s[2][3], s[2][0], s[2][1]
    s[3][0], s[3][1], s[3][2], s[3][3] = s[3][3], s[3][0], s[3][1], s[3][2]

Any guidance and information will be helpful.

Score:4
my flag

Then why is it working, I am not able to understand that.

Because the ShiftRows operation in AES leaves the top row unchanged; your code does the same (by ignoring it).

Score:3
tl flag

As you might notice, the first row (Index 0) is never called. This makes sense because there is no change in the values contained in the first row by definition. This can be better understood by the visualization contained in the Wikipedia article about AES:

enter image description here

The code you shared only updates the values corresponding to the definition of AES, but does not create a new array. Therefore only the rows that are affected must be recomputed and overwritten, resulting in only updating 3 rows.

I sit in a Tesla and translated this thread with Ai:

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.