1 AES Encryption Algorithm Main Step 1.1 AES Algorithm Overall Description L For a given clear text X, initialize State to X, and perform the addRoundKey operation, which will be RoundKey and State. l Each round in the previous NR-1 wheel, a replacement operation is made with S box, called subbytes; makes STATE STATETROWS; then do MixColumns for STATE; then operates the AddroundKey operation. l Subbytes, Shiftrows, and AddroundKey operations. l Define State as ciphertext Y. 1.2 pseudo code cipher (byte in [4 * nb], byte out [4 * nb], Word W [NB * (NR 1)]) Beginbyte State [4, NB] State = INADDROUNDKEY (state, w [0, NB-1]) for runk = 1 Step 1 TO NR-1Subbytes (State) Shiftrows (State) MixColumns (State) AddroundKey (State, W [Round * NB, (Round 1) * NB-1]) End Forsubbytes State) AddroundKey (State, W [NR * NB, (NR 1) * NB-1]) OUT = StateEnd2 Keyexpansion () Implementation 2.1 Requirements 128 Bit key to 9 wheels during encryption Cycling, then initially and last 2 rounds, the 11-round key is required. Each round key consists of 4 words. Each word consists of 4 Byte. 2.2 Algorithm Design Input: Byte [] Key, Byte [] w // key is the key W. The key W is the extended key output: byte [] w // extended key length is 4 * 4 * 11 processing: 1) establish one 4 BYTE's one-dimensional array, store a word. BYTE [] TEMP; 2) Send the key key [0..15] to W [0..15]; // has assigned 4 words to W. 3) FOR i = 4 to 43 // below each process (32 bit) Temp = W [i-1]; if (i = 0 mod 4) // Handling a word thr = 1 to 4 / / Word 4 Byte Processing Take the TEMP Array Subsequent Sequence in this loop to 1, 2, 3, 0 // Rotword operation If it is the first BYTE, RCON constant RCON (I / 4); TEMP [J] = SBOX (Temp [(J 1) / 4] ^ RCON constant end for temp = subs (rotword (temp)) ⊕rcon [I / 4] end if w [i] = w [i-4] ⊕Temp; end For 4) Output W3 Polynomial Multiplication MOD GF (28) Operation 3.1 Requirements Two BYTEs in a limited domain GF (28) Phase Multiplication, and MOD is not about polynomial M (x) = x8 x4 x3 x 1.
3.2 Algorithm Design Enter: Byte A, Byte B Output: BYTE R Mathematical Basics: GF (28) Finite Domain Nature: The addition of two elements is consistent with the two byte points 2; multiplication satisfies the law; consider One AIXI (i∈0-7) in the polynomial, multiplied by multiplex: b (x) = b7x7 b6x6 b5x5 b4x4 b3x3 b2x2 b1x b0, get B7x8 B6X7 B5x6 B4x5 B3X4 B2X3 B1X2 B0X (Formula 1) Explosive Result Module M (X) to obtain x * b (x). If B7 = 0, the formula 1 is x * b (x). If B7 is not equal to 0, the resulting result is x * b (x) from the formula 1. Use X by a polynomial referred to as X multiplication. Thus, AIXI multiplied by B (X), which can be used as X multiplication. X (hexadecimal representation is 0x02) Multiplied by one byte to move one bit and close to a bitwise model 2 with 0x1b, which is temporarily (). The higher complex multiplication of X can be implemented by repeating the XTime (). By adding intermediate results, any multiplication can be implemented using XTime (). For example: 57 * 13 = Fe, this is because: 57 * 02 = XTIME (57) = ae 57 * 04 = Xtime (AE) = 47 57 * 08 = Xtime (47) = 8E 57 * 10 = Xtime (8E) = 07 So 57 * 13 = 57 * (01⊕ 02 ⊕ 10) = 57 ⊕ AE⊕ 07 = Fe