2
$\begingroup$

Is it possible that someone can randomly input a key to AES 256 bit encryption and it is correct? What are the chances of this happening? Is it even possible or not?

$\endgroup$
  • $\begingroup$ That'd make them the luckiest person in the multiverse. $\endgroup$ – CodesInChaos Apr 5 '17 at 19:37
8
$\begingroup$

There are $2^{256}$ different AES keys, the chance that you hit the one right one on first try is thus $2^{-256}=\frac1{2^{256}}$.

To put this into perspective, here's a list of events that is roughly a billion times more likely to all happen (copied from Thomas Pornin's answer on Information Security SE):

  • The computer spontaneously catches fire during the key generation process.
  • Great Britain is wiped out by a falling asteroid during the very same second.
  • A rogue gorilla escaped from a zoo enters your living room and mauls you.
  • You win millions of dollars at the lottery three times in a row.

According to his answer, these events have roughly the chances of happening $2^{-45},2^{-50},2^{-60},2^{-71}$ each, which multiplies to $2^{-226}$ if you want all four to happen which is still roughly a billion times more likely than finding a 256-bit key on first try.

Note that this assumes that the key does indeed contain 256-bit of entropy, ie it can indeed take all the $2^{256}$ different values.

| improve this answer | |
$\endgroup$
3
$\begingroup$

Theoretically, this is possible... but, you have a better chance being hit by a meteor within the next second than seeing that happen as it practically boils down to "getting extremely lucky" with a brute-force attack.

Think about it: 256 bits (32 octets). You can do the math yourself to calculate the chances in both a best case as well as a worst case scenario.

Skipping the details the other answers already provided, you're thinking about someone lucky enough to "guess" that one correct password out of a pool of 1.1579209e+77 possibilities. To put that in perspective… this means that, on average, an attacker would need around and about $$57896044618658097711785492504343953926634992332820282019728792003956564819968$$ attempts to guess the correct password (better: key).

That is, assuming an optimal case with both a correct and safe AES implementation as well as cryptographically secure creation and handling of key material. Also, this doesn't look at other potential attack vectors like exploiting a weak block-cipher mode of operation or the likes - as the question specifically asks about the chance of a "randomly input a key" being correct.


Also see the related question "Probability of guessing random 128-bit AES key" as well as it's accepted answer.

| improve this answer | |
$\endgroup$
2
$\begingroup$

For AES-256 in order for someone to guess a key they would need to guess the sequence of 256 bits. There are $2^{256}$ possible sequences of length 256 bits and only one of them can be the correct key. For comparison the estimated number of atoms in the visible universe is $2^{265}$.

The possibility of randomly guessing 256-bit long sequence is $\frac{1}{2^{256}} = 2^{-256}$.

So while this is theoretically possible, the possibility of actual guessing is incredibly low.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.