Probability of guessing random 128-bit AES key Consider the following five events:


Correctly guessing a random 128-bit AES key on the first try
Winning a lottery with 1 million contestants
Winning a lottery with 1 million contestants 5 times in a row.
Winning a lottery with 1 million contestants 6 times in a row
Winning a lottery with 1 million contestants 7 times in a row


What is the order of these events from most likely to least likely?
To randomly guess a single key from a 128-bit key space has a chance of 1 divided by the number of elements or $\frac{1} {2^{128}}$ where $2^{128}$ is the number of keys possible.

To get ballpark figures to convert between base 2 exponents and base 10 exponents you can use the following trick:

Because $2^{10} = 1024 \approx 10^3$ you can easily count the number of decimal digits, then divide by 3 and multiply with 10. To go from the number of bits to the number of decimal digits multiply by 3 and divide by 10.

If you want to be more precise: you can divide or multiply with the constant value $\log_2(10) = \frac1{\log_{10}(2)} = \ln(10) / \ln(2) = 3.321928094\ldots$

(easy to remember in your pocket calculator or phone).

So as an AES key is 128 bits you can easily see that it represents about $10^{\frac {128 * 3}  {10}} = 10^{38.4}$ possible values. The bigger the possible value the less likely it is to guess (or brute force) one.



To get to the possibility of winning the lottery you have to calculate $\frac1n$ where $n$ is the number of contestants. To calculate the chance of winning it x times in a row you have to calculate $(\frac1n)^{x}$ which is equal to $\frac1{n^x}$.

As you can see that one million is $10^6$ you can then see that winning it 5 times in a row would be identical to pick one value out of $10^{6^5} = 10^{30}$ values. So you have a significantly better chance of winning the lottery 5 times: $\frac1{10^{30}}$ than picking a random 128 bit AES key: $\approx \frac1{10^{38.4}}$