The Wayback Machine - https://web.archive.org/web/20241011191714/https://www.geeksforgeeks.org/advanced-encryption-standard-aes/
Open In App

Advanced Encryption Standard (AES)

Last Updated : 16 Jul, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Advanced Encryption Standard (AES) is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) in 2001. AES is widely used today as it is much stronger than DES and triple DES despite being harder to implement. In this article, we will cover the AES, the Working of Cipher and Encryption-Decryption methods used in it, and its applications.

What is Advanced Encryption Standard (AES)?

Advanced Encryption Standard (AES) is a highly trusted encryption algorithm used to secure data by converting it into an unreadable format without the proper key. Developed by the National Institute of Standards and Technology (NIST), AES encryption uses various key lengths (128, 192, or 256 bits) to provide strong protection against unauthorized access. This data security measure is efficient and widely implemented in securing internet communication, protecting sensitive data, and encrypting files. AES, a cornerstone of modern cryptography, is recognized globally for its ability to keep information safe from cyber threats.

Points to Remember

  • AES is a Block Cipher.
  • The key size can be 128/192/256 bits.
  • Encrypts data in blocks of 128 bits each.

That means it takes 128 bits as input and outputs 128 bits of encrypted cipher text. AES relies on the substitution-permutation network principle, which is performed using a series of linked operations that involve replacing and shuffling the input data.

Working of The Cipher

AES performs operations on bytes of data rather than in bits. Since the block size is 128 bits, the cipher processes 128 bits (or 16 bytes) of the input data at a time.

The number of rounds depends on the key length as follows :

  • 128-bit key – 10 rounds
  • 192-bit key – 12 rounds
  • 256-bit key – 14 rounds

Creation of Round Keys

A Key Schedule algorithm calculates all the round keys from the key. So the initial key is used to create many different round keys which will be used in the corresponding round of the encryption.

Creation of Round Keys (AES)

Creation of Round Keys (AES)

Encryption

AES considers each block as a 16-byte (4 byte x 4 byte = 128 ) grid in a column-major arrangement.

[ b0 | b4 | b8 | b12 |
| b1 | b5 | b9 | b13 |
| b2 | b6 | b10| b14 |
| b3 | b7 | b11| b15 ]

Each round comprises of 4 steps :

  • SubBytes
  • ShiftRows
  • MixColumns
  • Add Round Key

The last round doesn’t have the MixColumns round.

The SubBytes does the substitution and ShiftRows and MixColumns perform the permutation in the algorithm.

Sub Bytes

This step implements the substitution.

In this step, each byte is substituted by another byte. It is performed using a lookup table also called the S-box. This substitution is done in a way that a byte is never substituted by itself and also not substituted by another byte which is a compliment of the current byte. The result of this step is a 16-byte (4 x 4 ) matrix like before.

The next two steps implement the permutation.

Shift Rows

This step is just as it sounds. Each row is shifted a particular number of times.

  • The first row is not shifted
  • The second row is shifted once to the left.
  • The third row is shifted twice to the left.
  • The fourth row is shifted thrice to the left.

(A left circular shift is performed.)

[ b0  | b1  | b2  | b3  ]            [ b0  | b1  | b2  | b3  ]
| b4 | b5 | b6 | b7 | -> | b5 | b6 | b7 | b4 |
| b8 | b9 | b10 | b11 | | b10 | b11 | b8 | b9 |
[ b12 | b13 | b14 | b15 ] [ b15 | b12 | b13 | b14 ]

Mix Columns

This step is a matrix multiplication. Each column is multiplied with a specific matrix and thus the position of each byte in the column is changed as a result.

This step is skipped in the last round.

[ c0 ]         [ 2  3  1  1 ]  [ b0 ]
| c1 | = | 1 2 3 1 | | b1 |
| c2 | | 1 1 2 3 | | b2 |
[ c3 ] [ 3 1 1 2 ] [ b3 ]

Add Round Keys

Now the resultant output of the previous stage is XOR-ed with the corresponding round key. Here, the 16 bytes are not considered as a grid but just as 128 bits of data.

Added Round Keys (AES)

Added Round Keys (AES)

After all these rounds 128 bits of encrypted data are given back as output. This process is repeated until all the data to be encrypted undergoes this process.

Decryption

The stages in the rounds can be easily undone as these stages have an opposite to it which when performed reverts the changes. Each 128 blocks goes through the 10,12 or 14 rounds depending on the key size.

The stages of each round of decryption are as follows :

  • Add round key
  • Inverse MixColumns
  • ShiftRows
  • Inverse SubByte

The decryption process is the encryption process done in reverse so I will explain the steps with notable differences.

Inverse MixColumns

 This step is similar to the Mix Columns step in encryption but differs in the matrix used to carry out the operation.

Mix Columns Operation each column is mixed independent of the other.

Matrix multiplication is used. The output of this step is the matrix multiplication of the old values and a

constant matrix

[b0] = [ 14  11  13  9]   [ c0 ]
[b1]=[ 9 14 11 13 ] [ c1 ]
[b2] =[ 13 9 14 11] [ c2 ]
[ b3 ]=[ 11 13 9 14 ] [ c3 ]

Inverse SubBytes

Inverse S-box is used as a lookup table and using which the bytes are substituted during decryption.

Function Substitute performs a byte substitution on each byte of the input word. For this purpose,

it uses an S-box.

Applications

AES is widely used in many applications which require secure data storage and transmission. Some common use cases include:

  • Wireless security: AES is used in securing wireless networks, such as Wi-Fi networks, to ensure data confidentiality and prevent unauthorized access.
  • Database Encryption: AES can be applied to encrypt sensitive data stored in databases. This helps protect personal information, financial records, and other confidential data from unauthorized access in case of a data breach.
  • Secure communications: AES is widely used in protocols such as internet communications, email, instant messaging, and voice/video calls. It ensures that the data remains confidential.
  • Data storage: AES is used to encrypt sensitive data stored on hard drives, USB drives, and other storage media, protecting it from unauthorized access in case of loss or theft.
  • Virtual Private Networks (VPNs): AES is commonly used in VPN protocols to secure the communication between a user’s device and a remote server. It ensures that data sent and received through the VPN remains private and cannot be deciphered by eavesdroppers.
  • Secure Storage of Passwords: AES encryption is commonly employed to store passwords securely. Instead of storing plaintext passwords, the encrypted version is stored. This adds an extra layer of security and protects user credentials in case of unauthorized access to the storage.
  • File and Disk Encryption: AES is used to encrypt files and folders on computers, external storage devices, and cloud storage. It protects sensitive data stored on devices or during data transfer to prevent unauthorized access.

Conclusion

 AES instruction set is now integrated into the CPU (offers throughput of several GB/s)to improve the speed and security of applications that use AES for encryption and decryption. Even though it has been 20 years since its introduction we have failed to break the AES algorithm as it is infeasible even with the current technology. To date, the only vulnerability remains in the implementation of the algorithm.

Frequently Asked Questions on Advanced Encryption Standard (AES) -FAQs

What is the AES Advanced Encryption Standard?

The Advanced Encryption Standard (AES) is a method that uses the same key to both encrypt and decrypt data. It doesn’t just encrypt the data once; instead, it applies multiple rounds of changes, like swapping, mixing, and rearranging data, to make it much more secure and harder to break.

What is the AES encryption code?

The AES encryption algorithm, also known as the Rijndael algorithm, is a type of symmetric block cipher that works with 128-bit blocks of data. It uses keys of 128, 192, or 256 bits to encrypt these blocks. After encrypting each block, it combines them to create the final encrypted message or ciphertext.

Where is AES used?

The AES algorithm is commonly used in various areas, like wireless security, protecting processors, encrypting files, and securing internet connections with SSL/TLS. It’s used frequently by government agencies, businesses, and other organizations to keep sensitive data safe.



Previous Article
Next Article

Similar Reads

Difference Between AES and RSA Encryption
In cryptography, this is the process of changing or transforming plain text or information into a cipher text or a text that the receiver, who is the person to whom the information is intended, can only decode. There are several algorithms in data encryption such as AES and RSA. AES represents a symmetric key algorithm whose processes depend on the
6 min read
Difference between Software Encryption and Hardware Encryption
Encryption is a vital component in securing digital information, and it can be implemented in two primary ways: the first type is known as software encryption while the other type is referred to as hardware encryption. As signified earlier, both means are used to safeguard data by encoding it in such a way that any other person who intends to acces
9 min read
Strength of Data encryption standard (DES)
Data encryption standard (DES) is a symmetric key block cipher algorithm. The algorithm is based on Feistel network. The algorithm uses a 56-bit key to encrypt data in 64-bit blocks. There are mainly two categories of concerns about the strength of Data encryption standard. They are: Concerns about the particular algorithm used. Concerns about the
2 min read
Simplified Data Encryption Standard Key Generation
Simplified Data Encryption Standard (S-DES) is a simple version of the DES Algorithm. It is similar to the DES algorithm but is a smaller algorithm and has fewer parameters than DES. It was made for educational purposes so that understanding DES would become simpler. It is a block cipher that takes a block of plain text and converts it into ciphert
3 min read
Simplified Data Encryption Standard | Set 2
Prerequisite - Simplified Data Encryption Standard | Set 1 Simplified Data Encryption Standard is a simple version of Data Encryption Standard having a 10-bit key and 8-bit plain text. It is much smaller than the DES algorithm as it takes only 8-bit plain text whereas DES takes 64-bit plain text. It was developed for educational purpose so that und
13 min read
Difference Between Aes and Twofish
AES and Twofish are two widely used symmetric key block ciphers, which are encryption algorithms used in modern cryptography. They play a vital role in safeguarding sensitive information across various applications. While they share some common features, they also have their own unique characteristics and differences. AES (Advanced Encryption Stand
5 min read
Why AES has Replaced DES, 3DES and TDEA?
The Advanced Encryption Standard (AES) has changed older encryption techniques like DES, 3DES, and TDEA because of its superior security, performance, and sturdy design. AES gives longer key lengths, making it more proof against attacks, and methods data more effectively. This transition reflects the want for more potent and greater reliable encryp
7 min read
Difference Between RC4 and AES
RC4 is a stream cipher and variable-length key algorithm. The main difference between RC4 and AES is that AES is a block cipher and RC4 is a stream cipher. Symmetric algorithm classes include block encryption and stream encryption. A block cipher encodes plain text in block sizes, whereas a stream cipher encodes bit by bit, simulating the flow of a
4 min read
Difference between AES and DES ciphers
Advanced Encryption Standard (AES) is a highly trusted encryption algorithm used to secure data by converting it into an unreadable format without the proper key while Data Encryption Standard (DES) is a block cipher with a 56-bit key length that has played a significant role in data security. In this article, we are going to discuss the difference
6 min read
End to End Encryption (E2EE) in Computer Networks
What is Encryption? Have you ever wondered how our emails, texts, photos, videos are sent over the Internet? Whenever you send anything over the Internet, it passes through a lot of servers, routers, and other devices where anyone can intercept it and get access to your private information. Thus, to tackle such mishap, encryption was introduced. In
2 min read
What is E2EE(End to End Encryption)?
E2EE or End to End Encryption refers to the process in which encryption of data are being done at the end host. It is an implementation of Asymmetric encryption and hence ensures a secure way of data communication. It is the most secure way to communicate privately and securely as data can be read-only by the sender and the receiver. No one else ca
3 min read
What is RC4 Encryption?
RC4 means Rivest Cipher 4 invented by Ron Rivest in 1987 for RSA Security. It is a Stream Ciphers. Stream Ciphers operate on a stream of data byte by byte. RC4 stream cipher is one of the most widely used stream ciphers because of its simplicity and speed of operation. It is a variable key-size stream cipher with byte-oriented operations. It uses e
5 min read
Fernet (symmetric encryption) using Cryptography module in Python
Cryptography is the practice of securing useful information while transmitting from one computer to another or storing data on a computer. Cryptography deals with the encryption of plaintext into ciphertext and decryption of ciphertext into plaintext. Python supports a cryptography package that helps us encrypt and decrypt data. The fernet module o
3 min read
Conventional Encryption
Conventional encryption is a cryptographic system that uses the same key used by the sender to encrypt the message and by the receiver to decrypt the message. It was the only type of encryption in use prior to the development of public-key encryption. It is still much preferred of the two types of encryption systems due to its simplicity. It is a r
3 min read
Evolution of Malwares from Encryption to Metamorphism
What are Malwares? Malware has always been a serious cause of concern for the antivirus and coding experts. These days the malware has evolved to an exceptionally sophisticated level making their detection quite difficult. This delay in the detection of malware allows it to spread more widely but it can be dealt with if antiviruses can scan the mal
5 min read
Rail Fence Cipher - Encryption and Decryption
Given a plain-text message and a numeric key, cipher/de-cipher the given text using Rail Fence algorithm. The rail fence cipher (also called a zigzag cipher) is a form of transposition cipher. It derives its name from the way in which it is encoded. Examples:  EncryptionInput : "GeeksforGeeks "Key = 3Output : GsGsekfrek eoeDecryptionInput : GsGsekf
15 min read
Encryption, Its Algorithms And Its Future
Encryption is very important in today's world, it is the process of transforming plaintext into ciphertext to maintain data security, and it is a crucial tool used in modern cyber security. It secures sensitive data by rendering it unreadable to unauthorized events, making sure of confidentiality, integrity, and authenticity. What is Encryption?Enc
6 min read
What is Data Encryption?
Data Encryption is an important part of preserving data integrity, and confidentiality, its importance cannot be overestimated. Almost the whole thing on the internet has been encrypted at some point. In this article, we will discuss data encryption and its importance. What is Data Encryption?Data Encryption is a method of preserving data confident
9 min read
Why is Encryption Important in Securing Data Transmission Over Networks?
Answer: Encryption is basically important for securing data transmission over Networks, because it makes shows that sensitive information remains private and inaccessible to unauthorized users.Below are the reasons specifying why encryption important in securing data transmission over networks: ConfidentialityEncryption process encodes the data int
2 min read
Encryption vs Hashing vs Salting
Data Integrity and Privacy form the building blocks of cybersecurity. These three core techniques- encryption, hashing, and salting, are considered to be the most important ones when it comes to the security of digital data. This is done to protect data during the process of storage and transmission, but they altogether play different roles and use
5 min read
Why is Encryption Important in Cyber Security?
Encryption is a way to protect our sensitive information by distributing it into a very secret code. This makes the data unreadable to anyone without the real key to decode it. Encryption is a very important role for cybersecurity experts because it makes sure that even if the hackers gain access of our private data they are not able to understand
6 min read
Twofish Encryption Algorithm
When it comes to data protection, encryption methods act as our buffering agents. One example of an excellent block cipher is the Twofish encryption algorithm. Although it was a competitor of another block cipher in the Advanced Encryption Standard competition and was later succeeded by the latter, it can still be used as a safe approach to protect
6 min read
How Does Wi-Fi Encryption Enhance Network Security?
Answer: Wireless security consists of encryption, authentication, access control, device security, access control, etc. It creates a layer of protection. The process starts by enabling the wireless network encryption method (such as WPA2 or WPA3) to block data transmission. Unauthorized people cannot read the data even if they are intercepted. Acce
2 min read
RC5 Encryption Algorithm
RC5 is a symmetric key block encryption algorithm designed by Ron Rivest in 1994. It is notable for being simple, fast (on account of using only primitive computer operations like XOR, shift, etc.) and consumes less memory. Example: Key : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Plain Text : 00000000 00000000Cipher Text : EEDBA521 6D8F4B15RC5
9 min read
Knapsack Encryption Algorithm in Cryptography
Knapsack Encryption Algorithm is the first general public key cryptography algorithm. It was developed by Ralph Merkle and Mertin Hellman in 1978. As it is a Public key cryptography, it needs two different keys. One is the Public key which is used for the Encryption process and the other one is the Private key which is used for the Decryption proce
6 min read
Public Key Encryption
Public key cryptography provides a secure way to exchange information and authenticate users by using pairs of keys. The public key is used for encryption and signature verification, while the private key is used for decryption and signing. When the two parties communicate with each other to transfer the intelligible or sensible message, referred t
8 min read
Encryption vs Digest in Cryptography
Encryption and Digest algorithms are used prominently in cryptography to protect the information which is always in high demand. Both are used as protection for data, however, their roles and capabilities of use are quite varied. Encryption replaces the normal or readable form of information (plaintext) with an unreadable form (ciphertext) to maint
6 min read
ElGamal Encryption Algorithm
ElGamal Encryption is a public-key cryptosystem. It uses asymmetric key encryption for communicating between two parties and encrypting the message. This cryptosystem is based on the difficulty of finding discrete logarithms in a cyclic group that is even if we know ga and gk, it is extremely difficult to compute gak. In this article, we will get t
6 min read
What is an Asymmetric Encryption?
Asymmetric encryption, also known as public-key cryptography, is a type of encryption that uses a pair of keys to encrypt and decrypt data. The pair of keys includes a public key, which can be shared with anyone, and a private key, which is kept secret by the owner. What is an Asymmetric Encryption?In asymmetric encryption, the sender uses the reci
8 min read
Difference Between Encryption and Encoding
Encryption and Encoding are terms often interchanged and used incorrectly, but they have distinct differences. Anyone dealing with communication networks or data security needs to be aware of these distinctions. In this article, we will learn the difference between the two terms, encryption and encoding. What is Encryption?It is a process used to c
4 min read