# how to calculate the average key search for AES-128bit?

Assume that an attacker has a special purpose application specific integrated circuit (ASIC) which checks $5\times 10^{8}$ keys per second, and she has a budget of $\$1$million. One ASIC costs$\$50$, and we assume $100\%$ overhead for integrating the ASIC (manufacturing the printed circuit boards, power supply, cooling, etc.).

How many ASICs can we run in parallel with the given budget?
How long does an average key search take? Relate this time to the age of the Universe, which is about $10^{10}$ years.

I know that we can run $20\ 000$ ASICs with ONE million budget, but I don't understand how to calculate the average key search, is it $2.5 \times 10^{19}$?

• I'm voting to close this question as off-topic because it's an exercise in arithmetic only tangentially related to cryptography. – Reid Sep 7 '17 at 21:55
• You missed the '100% overhead' so you have 10,000 ASICs. Although there is also ongoing cost for power and cooling, which your teacher seems to have left out. – dave_thompson_085 Sep 8 '17 at 3:20

Since key search is "embarrasingly parallel", i.e., you can have different ASICs searching different parts of the key space, you have $$20{,}000\approx 2\times 10^{11}$$ processors and the keyspace is of size $2^{128}$. There are $$3600\times 24\times 365.25\approx 2^{24.9}$$ seconds in a year so you can check $$2^{11} \times 2^{24.9} \times 2^{28.9}\approx 2^{64.8}$$ keys per year, the last factor being $2^{28.9}\approx5\times 10^8$. So this gives $$2^{127} \times 2^{-64.8} =2^{62.2}\approx 10^{18.72} \approx 5.25 \times 10^{18}$$years if I haven't made a mistake somewhere.
as $5\times 10^8.$