# AES128 vs AES256

Both AES-128 and AES-256 are symmetric encryption algorithms, meaning they use the same key for both encryption and decryption. This makes them efficient for encrypting and decrypting data. The primary difference between AES 128 and 256 lies in the key length used. These AES standards were selected by the U.S. National Institute of Standards and Technology (NIST) as encryption standards after a rigorous evaluation process.

Due to fast development of cloud based data applications, it has become essential to protect data during transmission. Various cryptography algorithms have been developed to ensure confidentiality, data protection, communication, authorization and non-repudiation. Cryptography techniques use mathematics and are used to transform data into secret data which only authorized users can read. There are two groups viz. symmetric and asymmetric cryptography.

Symmetric cryptography uses same key to encrypt and decrypt the message. The algorithms fall under this category include Blowfish, DES, 3DES, AES, CAS, RC6, TEA, IDEA, Serpent, Twofish etc.

Asymmetric cryptography uses two keys viz. one key for encryption as public key and one key for decryption as private key. The algorithms fall under this category include DH, SSH, RSA and SSL.

## What is AES ?

AES is block cipher technique in which encryption is done group wise at a time. It uses same key in encryption and decryption process and hence it is called symmetric cryptography.

There are two modes in which AES can be implemented viz. Counter mode and Output feedback mode. Operations performed by both the algorithms are depicted in the figure above.

Following are the benefits of AES encryption.

• Most robust security protocol due to its implementation in hardware and software.

• All the blocks follow similar encryption procedure.

• It is stronger and faster compare to Triple-DES algorithm.

• It uses encryption keys of longer size (128 bits or 192 bits or 256 bits). Hence it is difficult to break.

• This official recognition by NIST increases their credibility and widespread use.

Following are the drawbacks of AES encryption.

• Algorithm has simple algebraic structure but it is complex to implement in software.

• AES in counter mode is very challenging to implement in software with respect to performance and security.

## 128 bit encryption vs 256

AES-128 uses 128 bit or 16 bytes key length for encryption. It is a block cipher which means it processes data in fixed size blocks i.e. 128 bits at a time.

Like AES-128 and AES-192, AES-256 is a symmetric encryption algorithm, which means it uses the same key for both encryption and decryption. While AES-256 offers increased security, it may be slower in terms of processing speed compared to AES-128 due to the longer key length.

Both of these techniques follow same process as below except size of the keys. AES-128 uses 128 bit key size
where as AES-256 uses 256 bit key size. There are 10 rounds in AES-128 where as 14 rounds in AES-256 encryption process.

Encryption process consists of different rounds as per key size and each round follows steps outlined below for
both AES 128 and 256 encryption techniques.

➨Subbytes

➨Shiftrows

➨MixColumns

➨AddRoundKey

The decryption process for each round follows following four steps.

➨Inverse ShiftRows

➨Inverse substitute bytes

➨AddRoundKey key

➨Inverse mix columns

Here's a simple example to illustrate the difference in key lengths between AES-128 and AES-256:

AES-128 Key: [Vector of 1s and 0s with 128 length]

AES-256 Key: [Vector of 1s and 0s with 256 length]

As you can see, the AES-256 key is longer and more complex than the AES-128 key.

## Difference between AES 128 and AES 256

Following table mentions comparison between AES 128 and 256 encryption techniques with respect to various parameters.

Parameters |
AES-128 |
AES-256 |
---|---|---|

• Key Length (Nk words) | 4 (i.e. 128 bits) | 8 (i.e. 256 bits) |

• Block Size (Nb words) or input plain text blocks | 4 (i.e. 128 bits) | 4 (i.e. 128 bits) |

• Number of rounds (Nr) | 10 | 14 |

• Matrix Block | 4 x 4 | 4 x 8 |

• Attempts required to break | 2^{128} |
2^{256}, higher than AES-128 |

• Level of security | Considered secured | Much stronger |

• Processing power | Less than AES-256 | More than AES-128 |

• Execution time or latency | Less | More |

**Conclusion** :
It's important to note that the primary difference between AES128 and AES256 lies in the key length and,
consequently, the potential security level they offer. AES-256 uses a longer key (256 bits) than AES-128 (128 bits),
which theoretically makes it more resistant to brute-force attacks. However, the choice between
AES 128 vs 256 depends on the specific security requirements of an application, as well as performance considerations.
Though, the AES-256 key is longer and more complex than the AES-128 key,
AES256 is not necessarily "better" than AES128 in all situations.
AES 128 is still considered secure for most practical purposes and
is often preferred for its computational efficiency, while AES 256 is used in scenarios
where an extra layer of security is desired.

Also refer advantages and disadvantages of AES encryption >> and AES MATLAB Code >>.