Perform the initialization structure of the AES algorithm from a cryptographic key.
[S] = NL_S_AESInitialization(K)
Cryptographic key.
Structure with s-boxes, expanded key, etc.
NL_S_AESInitialization generates the initial structure for parameters and tables of the AES algorithm (WIKIPEDIA). This function is based on the matlab module created by Stepan Matejka (Project).The cryptographic key K can be a vetor of 16 integers ([0:255]) (AES-128), 24 integers (AES-192), and 32 integers (AES-256). The structure is composed by 18 elements. S.key provides the original cryptographic key. S.bytes is the key length in bytes. S.length is the key length in bits. S.rounds provides the number of rounds that must be done (10 for AES-128, 12 for AES-192 and 14 for AES-256). S.mod_pol represents the irreducible polynomial for multiplication in a finite field 0x11b : bin2dec('100011011')=283. S.aes_logt and S.aes_ilogt are the logarithm lookup table and its reverse. S.s_box and S.inv_s_box store the s-box and its reverse. S.mix_col2, S.mix_col3, S.mix_col9, S.mix_col11, S.mix_col13 and S.mix_col14 are tables for fast MixColumns. S.keyexp is the expended key. S.poly_mat and S.inv_poly_mat are poly and its reverse.
//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)//application of NL_S_AESInitialization | ![]() | ![]() |