So I'll teach a lil bit about AES
AES stands for Advanced Encryption Standard made by the U.S. Government blah blah blah...
This is what the decipher is:
AES is based on a design principle known as a http://en.wikipedia.org/wiki/Substitution-permutation_network. It is fast in both http://en.wikipedia.org/wiki/Computer_software and http://en.wikipedia.org/wiki/Hardware. Unlike its predecessor, DES, AES does not use a http://en.wikipedia.org/wiki/Feistel_network.
AES has a fixed http://en.wikipedia.org/wiki/Block_size_%28cryptography%29 of 128 http://en.wikipedia.org/wiki/Bit and a http://en.wikipedia.org/wiki/Key_size of 128, 192, or 256 bits, whereas Rijndael can be specified with block and key sizes in any multiple of 32 bits, with a minimum of 128 bits. The blocksize has a maximum of 256 bits, but the keysize has no theoretical maximum.
AES operates on a 4×4 http://en.wikipedia.org/wiki/Column-major_order matrix of bytes, termed the state (versions of Rijndael with a larger block size have additional columns in the state). Most AES calculations are done in a special finite field.
The AES cipher is specified as a number of repetitions of transformation rounds that convert the input plaintext into the final output of ciphertext. Each round consists of several processing steps, including one that depends on the encryption key. A set of reverse rounds are applied to transform ciphertext back into the original plaintext using the same encryption key. High-level description of the algorithm
The SubBytes step
- KeyExpansion—round keys are derived from the cipher key using http://en.wikipedia.org/wiki/Rijndael_key_schedule
- Initial Round
- AddRoundKey—each byte of the state is combined with the round key using bitwise xor
- SubBytes—a non-linear substitution step where each byte is replaced with another according to a http://en.wikipedia.org/wiki/Rijndael_S-box.
- ShiftRows—a transposition step where each row of the state is shifted cyclically a certain number of steps.
- MixColumns—a mixing operation which operates on the columns of the state, combining the four bytes in each column.
- Final Round (no MixColumns)
In the SubBytes step, each byte in the matrix is updated using an 8-bit http://en.wikipedia.org/wiki/Substitution_box, the http://en.wikipedia.org/wiki/Rijndael_S-box. This operation provides the non-linearity in the http://en.wikipedia.org/wiki/Cipher. The S-box used is derived from the http://en.wikipedia.org/wiki/Multiplicative_inverse over http://en.wikipedia.org/wiki/Finite_field
), known to have good non-linearity properties. To avoid attacks based on simple algebraic properties, the S-box is constructed by combining the inverse function with an invertible http://en.wikipedia.org/wiki/Affine_transformation. The S-box is also chosen to avoid any fixed points (and so is a http://en.wikipedia.org/wiki/Derangement), and also any opposite fixed points. The ShiftRows step
The ShiftRows step operates on the rows of the state; it cyclically shifts the bytes in each row by a certain http://en.wikipedia.org/wiki/Offset_%28computer_science%29. For AES, the first row is left unchanged. Each byte of the second row is shifted one to the left. Similarly, the third and fourth rows are shifted by offsets of two and three respectively. For the block of size 128 bits and 192 bits the shifting pattern is the same. In this way, each column of the output state of the ShiftRows step is composed of bytes from each column of the input state. (Rijndael variants with a larger block size have slightly different offsets). In the case of the 256-bit block, the first row is unchanged and the shifting for second, third and fourth row is 1 byte, 3 bytes and 4 bytes respectively—this change only applies for the Rijndael cipher when used with a 256-bit block, as AES does not use 256-bit blocks. The MixColums step
In the MixColumns step, the four bytes of each column of the state are combined using an invertible http://en.wikipedia.org/wiki/Linear_transformation. The MixColumns function takes four bytes as input and outputs four bytes, where each input byte affects all four output bytes. Together with ShiftRows, MixColumns provides http://en.wikipedia.org/wiki/Diffusion_%28cryptography%29 in the cipher.
During this operation, each column is multiplied by the known matrix that for the 128 bit key is
The multiplication operation is defined as: multiplication by 1 means leaving unchanged, multiplication by 2 means shifting byte to the left and multiplication by 3 means shifting to the left and then performing http://en.wikipedia.org/wiki/Xor with the initial unshifted value. After shifting, a conditional http://en.wikipedia.org/wiki/Xor with 0x11B should be performed if the shifted value is larger than 0xFF.
In more general sense, each column is treated as a polynomial over GF
) and is then multiplied modulo x4+1 with a fixed polynomial c(x) = 0x03 · x3 + x2 + x + 0x02. The coefficients are displayed in their http://en.wikipedia.org/wiki/Hexadecimal equivalent of the binary representation of bit polynomials from GF
(2)[x]. The MixColumns step can also be viewed as a multiplication by a particular http://en.wikipedia.org/wiki/MDS_matrix in a http://en.wikipedia.org/wiki/Finite_field. (This is further explained here: http://en.wikipedia.org/wiki/Rijndael_mix_columns ) The AddRoundKey step
In the AddRoundKey step, the subkey is combined with the state. For each round, a subkey is derived from the main http://en.wikipedia.org/wiki/Key_%28cryptography%29 using http://en.wikipedia.org/wiki/Rijndael_key_schedule; each subkey is the same size as the state. The subkey is added by combining each byte of the state with the corresponding byte of the subkey using bitwise http://en.wikipedia.org/wiki/Exclusive_or. Optimization of the cipher
On systems with 32-bit or larger words, it is possible to speed up execution of this cipher by combining SubBytes and ShiftRows with MixColumns, and transforming them into a sequence of table lookups. This requires four 256-entry 32-bit tables, which utilizes a total of four kilobytes (4096 bytes) of memory—one kilobyte for each table. A round can now be done with 16 table lookups and 12 32-bit exclusive-or operations, followed by four 32-bit exclusive-or operations in the AddRoundKey step.
If the resulting four kilobyte table size is too large for a given target platform, the table lookup operation can be performed with a single 256-entry 32-bit (i.e. 1 kilobyte) table by the use of circular rotates. Something Else
Test vectors are a set of known ciphers for a given input and key. http://en.wikipedia.org/wiki/NIST distributes the reference of AES test vectors as http://csrc.nist.gov/groups/STM/cavp/documents/aes/KAT_AES.zip
Using a byte-oriented approach, it is possible to combine the SubBytes, ShiftRows, and MixColumns steps into a single round operation.
Here's something I found on this:
Well... those links...