Introduction of AES encryption algorithm

AES (Advanced Encryption Standard) is a specification used by the National Institute of Standards and Technology to encrypt electronic data. It is expected to become a recognized method to encrypt digital information such as finance, telecommunications and government. The National Institute of Standards and Technology (NIST) established a new advanced data encryption standard (AES) specification on May 26th, 2002. AES is a new encryption algorithm, which can be used to protect electronic data.

1998 The National Institute of Standards and Technology (NIST) started the first round of AES analysis, testing and collection, and * * * produced 15 candidate algorithms. They include cast-256, crypton, deal, DFC, E2, frog, HPC, Loki97, Magenta, Mars, RC6, Rijndael, Safer+, Serpent and Two Fish. Five candidate algorithms entered the second round: Mars, RC6, Rijndael, Serpent and Two Fish. 1999.3 conducted the second round of analysis and testing on AES2, and finally confirmed the success of Rijndael algorithm. NIST formulated a new advanced encryption standard (AES) specification on May 26th, 2002.

AES is a typical symmetric encryption algorithm, which is widely used. After the data sender uses a special encryption algorithm to process the plaintext and encryption key, it converts them into complex encrypted ciphertext and sends it out. After receiving the ciphertext, if the receiver wants to interpret the original text, it needs to decrypt the ciphertext with the encryption key and the inverse algorithm of the same algorithm, so as to restore it to readable plaintext. In the symmetric encryption algorithm, only one key is used, and both the sender and the receiver use this key to encrypt and decrypt the data, which requires the decryptor to know the encryption key in advance. Its advantage is that the symmetric encryption algorithm has the characteristics of open algorithm, small calculation, fast encryption speed and high encryption efficiency. The disadvantage is that both parties use the same key, and the security cannot be guaranteed.

Off topic here, asymmetric encryption algorithms, such as the famous RSA algorithm, use two completely different but perfectly matched keys-public key and private key. When using asymmetric encryption algorithm to encrypt files, only a pair of matching public keys and private keys are needed to complete the encryption and decryption process of plaintext. Encrypt plaintext with public key and decrypt ciphertext with private key. Moreover, the encryptor knows the public key of the receiver, and only the decryptor knows its own private key.

AES algorithm is based on permutation and permutation operation. Arrangement is to rearrange data, and replacement is to replace one data unit with another. AES uses several different methods to perform permutation and permutation operations. AES is an iterative symmetric key block cipher. It can use 128, 192 and 256-bit keys to encrypt and decrypt data with 128 bits (16 bytes). Unlike the key pair used in public key encryption, symmetric key encryption uses the same key to encrypt and decrypt data. The number of bits of encrypted data returned by block cipher is the same as that of input data. Iterative encryption uses a circular structure in which input data is repeatedly permuted and replaced. According to records, in 400 BC, the ancient Greeks invented the permutation code. 188 1 year, the world's first telephone secrecy patent appeared. During the Second World War, the German military started the Enigma cipher machine, and cryptography played a very important role in the war.

AES encryption process operates on a 4×4 byte matrix, which is also called "state", and its initial value is a plaintext block (the size of an element in the matrix is one byte in the plaintext block). When encrypting, each round of AES encryption cycle (except the last round) includes four steps:

/kloc-0 1.AddoundKey—-Each byte in the matrix is XOR with this round of keys; Each subkey is generated by a key generation scheme.

2. Subbyte —— Replace each byte with the corresponding byte with a look-up table through a nonlinear replacement function.

3.shift rows— Move each horizontal column in the matrix circularly.

4. Mix columns-In order to completely mix every straight operation in the matrix. This step uses linear transformation to mix every four bytes inline.