# Can a 1 byte difference in AES 128 bit keys make huge difference in output?

If we take some randomly generated key of AES-128 and we change any random 1 byte of that 16 byte key, will this make huge difference in the AES cipher text generated over same input string?

Does this 1 byte change makes output look like uniformly random? Does it have an effect on security?

• You can test this yourself echo abcd | openssl enc -aes-128-ecb -nosalt -K 000000000000000000000000000000ff -iv 00 | xxd -p, then change one byte of the key and try again. Jul 24 '15 at 17:22
• @mikeazo Yes, I can see the output is totally different (tried on AES ECB and output possibly looks uniformly random(not sure though)) But does this give any advantage considering security ? (Does AES has stronger avalanche effect ?) Jul 24 '15 at 17:27
• RE: security, if that is your question, you should edit that in. As is, your question just asks if making a 1 byte change in the key results in a huge change in the ciphertext. Does AES have stronger avalanche effect compared to what? Jul 24 '15 at 17:32
• @mikeazo my bad. I wanted to ask if this 1 byte change makes output look like uniformly random, this is due to the avalanche effect that AES posses ? Jul 24 '15 at 17:51
• yes, if you change the key (no matter how much), the ciphertext will be indistinguishable from random with your old key.
– SEJPM
Jul 24 '15 at 20:35

If we take some randomly generated key of AES-128 and we change any random 1 byte of that 16 byte key, will this make huge difference in the AES cipher text generated over same input string?

Yes. The outputs with different keys differ greatly. If you pick two random keys the outputs must look completely uncorrelated, or an attacker could gain an advantage just by generating his own key.

With some changes the picture is a bit more complicated, because there are related-key attacks on AES. There the attacker would have to get access to encryptions with keys derived from the original, but if they did they would have an advantage since the outputs aren't totally independent.

However, that's not a very realistic attack in practice, and anyway AFAIK they only exist on AES-192 and AES-256, not (the full 10 rounds of) AES-128.

Does this 1 byte change makes output look like uniformly random? Does it have an effect on security?

In the absence of better attacks, yes. It would be good for security if it was always true, but it's not a huge problem if it isn't, as long as random keys still produce unrelated-looking ciphertext.

The keyword you are looking for is related-key attack, where exactly this kind of different input keys (without the restriction to 1 byte) is used to break the cipher. (Wiki)

Related crypto-SE topic: Related-key attacks on AES

A related-key attack on AES has been analyzed by Biryukov and Khovratovich

Also worth a look: Security section of Wikpedia for a decent overview and current state. However, none of these attacks are considered practical ($2^{99.5}$ is still way too much to be achieveable).

If your question is actually specific to your "1 byte change", then this is probably too specific for the proposed related-key attacks to work... even if they were practical.