<< NL_S_AESAddRoundKey NL_S: Security NL_S_AESEncryption >>

NARVAL >> NL_S: Security > NL_S_AESDecryption

NL_S_AESDecryption

Perform the AES decryption.

Calling Sequence

[O] = NL_S_AESDecryption(S,I)

Arguments

S :

AES structure with s-boxes, expanded key, etc.

I :

Plain text.

O :

Cipher text.

Description

NL_S_AESDecryption performs the decryption of the cipher text I into the plain text O in respect with the AES algorithm (WIKIPEDIA).

Pseudo-Code

AES_Decrypt(State, K) {
    KeyExpansion(K, RoundKeys);
    /* Initial Addition */
    AddRoundKey(State, RoundKeys[Nr]);
    /* Nr-1 rounds */
    for (r=Nr-1; i>0; r--) {
        InvShiftRows(State);        
        InvSubBytes(State);
        AddRoundKey(State, RoundKeys[r]);
        InvMixColumns(State);
    }
    /* FinalRound */
    InvShiftRows(Out);
    InvSubBytes(Out);
    AddRoundKey(Out, RoundKeys[0]);
}

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
//encryption
[out]=NL_S_AESEncryption(s128,in);//encryption
outh=dec2hex(out);//decimal
[ino]=NL_S_AESDecryption(s128,out);//application of NL_S_AESDecryption
inoh=dec2hex(ino);//decimal
[in;out;ino]
[inh;outh;inoh]

Dependency

NL_S_AESShiftRowsR, NL_S_AESMixColumnsR

Report an issue
<< NL_S_AESAddRoundKey NL_S: Security NL_S_AESEncryption >>