<< NL_S: Security NL_S: Security NL_S_AESDecryption >>

NARVAL >> NL_S: Security > NL_S_AESAddRoundKey

NL_S_AESAddRoundKey

Addition (element to element in F256) between a state matrix and a round key.

Calling Sequence

[R] = NL_S_AESAddRoundKey(T,S,I)

Arguments

T :

4x4 state matrix.

S :

AES structure.

I :

Round index.

R :

4x4 matrix.

Description

NL_S_AESAddRoundKey performs the AddRoundKey step of the AES algorithm (WIKIPEDIA). During this step, the matrix T is modified in respect with the addition (element by element in F256) with a round key of index i. .

Examples

//128 bits
key128h={'2b','7e','15','16','28','ae','d2','a6','ab','f7','15','88','09','cf','4f','3c'};//16 bytes
key128=hex2dec(key128h);
[s128]=NL_S_AESInitialization(key128);//initialization of the structure
inh={'32','43','f6','a8','88','5a','30','8d','31','31','98','a2','e0','37','07','34'};//plain text
in=hex2dec(inh);//decimal
state = matrix(in, 4, 4)//reshape
// Initial round : AddRoundKey keyexp(1:4)
i=0;
//bitxor
[RState]=NL_S_AESAddRoundKey(state,s128,i)//application of NL_S_AESAddRoundKey
(s128.keyexp((1:4) + 4*i, :))'

Report an issue
<< NL_S: Security NL_S: Security NL_S_AESDecryption >>