128 or 256 bit Encryption: Which Should I Use? - Ubiq (2024)

When discussing symmetric encryption algorithms – like the Advanced Encryption Standard (AES) – you may have been considering using AES-128 or AES-256. The last three digits represent the length of the secret key – think of it like the number of teeth in a physical key. From a security perspective, a 256-bit secret key is obviously better, but does it really matter which of the two options you choose? This article walks through some of the main security considerations for AES-128 and AES-256.

Brute Force Attack Protection

A brute force key guessing attack is where an attacker tries each potential secret key until the right one is found. This attack is guaranteed to succeed (eventually) and (ideally) should be the fastest way to break an encryption algorithm.

When discussing brute force attack protection, understanding just what different key lengths mean is essential. With the impending arrival of quantum computing, it is also good to know how they will impact cryptographic security. Are the current forms of AES strong enough?

The Difference in Key Length

The main difference between 128 and 256-bit encryption algorithms is the length of the secret key that they use. The 128 and 256 in AES-128 and AES-256 means that the two algorithms use 128-bit and 256-bit keys respectively.

The longer the secret key, the harder it is for an attacker to guess via brute force attack. However, AES-256 is not just twice as strong as AES-128.

With 128 and 256-bit secret keys, AES-128 and AES-256 have 2128 and 2256 potential secret keys respectively. With binary keys, each bit added to the key length doubles the key space. This means that AES-256 has 2^128 or 340,282,366,920,938,463,463,374,607,431,768,211,456 times as many keys as AES-128.

As a result, a brute force attack against an AES-256 key is much harder than against an AES-128 key. However, even a 128-bit key is secure against attack by modern technology. At its peak, the Bitcoin network – arguably the largest modern use of computational power for cryptography – performed approximately 150*10^18≈2^67 operations per second. Assuming that these operations are of equal difficulty to a brute force attack, it would take the Bitcoin network over 70,000,000,000,000,000,000,000,000 years to crack a single AES-128 key.

Resistance to Quantum Computing

The threat of quantum computing to cryptography has been well-publicized. Quantum computers work very differently than classical ones, and quantum algorithms can make attacks against cryptography much more efficient.

In the case of asymmetric encryption algorithms (like RSA), quantum computing completely breaks them. However, for symmetric algorithms like AES, Grover’s algorithm – the best known algorithm for attacking these encryption algorithms – only weakens them. Grover’s algorithm decreases the effective key length of a symmetric encryption algorithm by half, so AES-128 has an effective key space of 2^64 and AES-256 has an effective key space of 2^128.

However, while this seems significant, it doesn’t break either algorithm. With the right quantum computer, AES-128 would take about 2.61*10^12 years to crack, while AES-256 would take 2.29*10^32 years. For reference, the universe is currently about 1.38×10^10 years old, so cracking AES-128 with a quantum computer would take about 200 times longer than the universe has existed.

This also makes the assumption that an attacker has the “right” quantum computer. Cracking AES-128 would take an estimated 2,953 logical qubits and AES-256 would require 6,681. In 2020, the largest quantum computer had 65 qubits with a goal of hitting 1,000 by 2023.

128 and 256-Bit Algorithms Under the Hood

Brute force attacks against a secret key are the best potential attack against a secure algorithm but what if the algorithm is has a vulnerability?

AES is broken up into two distinct algorithms: the encryption algorithm (which does the actual encryption) and the key schedule (which converts the secret key into round keys). The security of each of these matters to the security of AES.

The Encryption Algorithm

AES-128 and AES-256 use an almost identical encryption algorithm. Each encryption algorithm takes a set of operations and applies them a certain number of times or “rounds”. The only difference between AES encryption algorithms is the number of rounds: AES-128 uses 10 and AES-256 uses 14.

This means that, if an attack against the AES algorithm was discovered, it would likely affect both AES-128 and AES-256. The only difference is if the attack only worked up to a certain number of rounds of AES (which some AES attacks do). If an attack worked for at least ten rounds but less than fourteen, then a clear winner exists between AES-128 and AES-256. However, no such attack is currently known for AES.

The Key Schedule

The key schedule is where AES-128 and AES-256 become very different. The AES-128 key schedule is designed to turn a 128-bit secret key into ten 128-bit round keys. The AES-256 key schedule transforms a 256-bit secret key into fourteen 128-bit rounds keys.

Of the two, the AES-128 key schedule is actually more secure. The AES-256 key schedule has known weaknesses that might make it possible to perform related key attacks against the algorithm.

A related key attack should never happen in real life. For it to occur, an attacker needs to:

  1. Convince the key owner to take their existing encryption key
  2. Create three other keys based on this key using relationships known to the attacker
  3. Encrypt 299.5 (that’s eight followed by 29 zeros) blocks of data with these keys

Even if this attack were feasible, it can be avoided simply by using good key generation practices. A truly random key should never be vulnerable to a related key attack because it has no related keys.

Despite the fact that this attack is infeasible to perform, some cryptographers advise – when given a choice between AES-128 and AES-256 with no constraints – using AES-128 over AES-256. If you have a simpler algorithm with a stronger key schedule, why use the more complex one?

Picking Between AES-128 and AES-256

128-bit and 256-bit AES both have their pros and cons. AES-128 is faster and more efficient and less likely to have a full attack developed against it (due to a stronger key schedule). AES-256 is more resistant to brute force attacks and is only weak against related key attacks (which should never happen anyway).

Since both algorithms are secure against modern and anticipated future threats, the choice between them doesn’t really matter from a security perspective. Our best guidance is that AES-128 provides more than adequate security while being faster and more resource-efficient but readers who want that extra security provided by greater key sizes and more rounds in the algorithm should choose AES-256.

The Ubiq Platform currently supports both AES-256-GCM and AES-128-GCM, so if you’re interested to find out more about how to quickly build data encryption into any application, watch our short demo video.

128 or 256 bit Encryption: Which Should I Use? - Ubiq (2024)

FAQs

128 or 256 bit Encryption: Which Should I Use? - Ubiq? ›

Of the two, the AES-128 key schedule is actually more secure. The AES-256 key schedule has known weaknesses that might make it possible to perform related key attacks against the algorithm. A related key attack should never happen in real life.

Is 256-bit encryption better than 128? ›

With the changing time's security should have stronger encryption to secure from online attacks. Hackers are continuously involved in breaking weak or old encryption. 256-bit encryption is much stronger than 128-bit. 256-bit encryption delivers a higher level of protection.

Is 128-bit security enough? ›

If you ask how long will it take to crack 128-bit encryption using a brute force attack, the answer would be 1 billion years. A machine that can crack a DES key in a second would take 149 trillion years to crack a 128-bit AES key. Hence, it is safe to say that AES-128 encryption is safe against brute-force attacks.

What benefit does a key size of 256 bits offer over a key size of 128 bits for encryption and security? ›

128-bit encryption is considered secure and has been widely adopted for many years. Still, with quantum computing on the rise, 256-bit encryption offers an extra layer of security due to its larger key size and key space.

How long would it take a quantum computer to crack 128-bit encryption? ›

However, with a powerful enough quantum computer, an attacker could use a technique called Grover's algorithm to guess the key much faster than with a classical computer. In fact, a quantum computer with 128 qubits could crack a 128-bit AES key in a matter of seconds.

Is 256-bit encryption enough? ›

AES-256 encryption is extremely secure. It is the most secure encryption algorithm available today and is used extensively in government and military applications, as well as by businesses operating in highly regulated industries.

Who uses 128-bit encryption? ›

Firefox and Safari browsers and DI. Both browsers recently designated as supported for use with DI products, Firefox 1.0 and Safari 1.2, use strong 128-bit encryption when accessing secure sites, to ensure safe and secure transmittal of private data such as account and payment information.

How hard is it to crack 128-bit encryption? ›

The EE Times points out that even using a supercomputer, a “brute force” attack would take one billion years to crack AES 128-bit encryption.

Why don t we use 128-bit computers? ›

A 128-bit processor may never occur because there is no practical reason for doubling the basic register size. One of the reasons for migrating from 32-bit to 64-bit computers was memory (RAM) addressing; however, for all practical purposes, there was only a need for a few more bits beyond 32 (see binary values).

How hard is it to crack 256-bit encryption? ›

With a symmetric encryption key 256 bits long (2 to the 256th power possible combinations!), on current hardware it would take literally millions of years.

What is the best key size for encryption? ›

Diffie-Hellman (DH) Key Exchange: • For modern applications, a minimum of 2048-bit is recommended, but 3072-bit or 4096-bit is becoming more common for stronger security. 4. Elliptic Curve Cryptography (ECC): • ECC offers equivalent security with shorter key lengths compared to traditional algorithms.

Has AES-128 ever been cracked? ›

The difference between cracking the AES-128 algorithm and AES-256 algorithm is considered minimal. Whatever breakthrough might crack 128-bit will probably also crack 256-bit. In the end, AES has never been cracked yet and is safe against any brute force attacks contrary to belief and arguments.

Is a 256-bit encryption key more secure than a 128-bit key? ›

This means that AES-256 has 2^128 or 340,282,366,920,938,463,463,374,607,431,768,211,456 times as many keys as AES-128. As a result, a brute force attack against an AES-256 key is much harder than against an AES-128 key. However, even a 128-bit key is secure against attack by modern technology.

What is the best encryption today? ›

AES 256-bit encryption is the strongest and most robust encryption standard that is commercially available today.

Can a quantum computer crack AES 256? ›

AES256 is currently quantum resistant, and will remain so until quantum computers become at least an order-of-magnitude more powerful than the current cutting-edge technology in quantum computing.

Can a quantum computer hack ethereum? ›

Quantum computers could potentially break the security of Ethereum, making it possible to steal users' funds by reversing the encryption that protects… Buterin also said Ethereum is ready for such a challenge. The developers have a backup plan to fight these risks and keep users' assets safe.

Is 256-bit encryption slower than 128? ›

Efficiency. In terms of efficiency, 128-bit encryption generally performs faster compared to 256-bit encryption. The larger key size in 256-bit encryption requires more computational resources and processing power, resulting in slightly slower encryption and decryption operations.

Has AES 128 ever been cracked? ›

The difference between cracking the AES-128 algorithm and AES-256 algorithm is considered minimal. Whatever breakthrough might crack 128-bit will probably also crack 256-bit. In the end, AES has never been cracked yet and is safe against any brute force attacks contrary to belief and arguments.

What is the strongest bit encryption? ›

AES 256-bit encryption is the strongest and most robust encryption standard that is commercially available today.

Top Articles
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5772

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.