# How long brute force AES-128 at 24 bits of key

I have 1 block of encrypted data with AES-128, but I know 104 bits of 128 bits the key.

How long it will take to brute force 24 bits of a key at Intel I 7 CPU? How can I calculate that?

I have an Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz. Intel I7 has around 10 generations to speak of. The result cannot be accurate without providing the actual referenced Intel I7.

Here is the method;

Run openssl speed -evp aes-128-cbc command. That will give you the metric.

My CPUs output:

aes-128-cbc for 3s on 16 size blocks: 144516288 aes-128-cbc's in 3.00s,

that is $$144516288 = 2^{27.1066568628459}$$. Therefore 1 seconds is more than enough.

$$\begin{array}{|c|r|r|} \hline 2^i & \text{seconds} & \text{years} \\ \hline 2^{30} & 22.29 & 0.0000007\\ \hline 2^{40} & 22824.65 & 0.0007\\ \hline 2^{50} & 23372450.03 & 0.74\\ \hline 2^{60} & 23933388835.87 & 758.92\\ \hline \vdots & \vdots & \vdots \\ \hline 2^{128} & 7.06388957874987e30 & 2.23994469138441e23\\ \hline \end{array}$$

The below code ( tested in SageMath )

SecondsInADay = 86400
SecondsInAYear = 31536000
TotalCBCin3Sec = 144516288 #your CPU time from openssl speed -evp aes-128-cbc
power = (30,40,50,60,128)

for i in power:
print('seconds for 2^{%d} =' % (i),end="")
print(((2^i *3.0)/TotalCBCin3Sec).str(no_sci=2))
for i in power:
print('years for 2^{%d}   =' % (i),end="")
print(((2^i *3.0)/TotalCBCin3Sec/SecondsInAYear).str(no_sci=2))

• 2^28.10665=289,031,201 not 144,516,288 that mean to run at 50bits 2^50/(144516288/3)=23,372,450 around seconds in your CPU? – Brute force Nov 17 '20 at 17:15
• @Bruteforce my mistake, I've added 1, corrected. Yes, the ratio is correct. That is around 270 days – kelalaka Nov 17 '20 at 17:18
• technically that benchmark is for block encryption not key expansion + block encryption, but the key schedule for AES is VERY fast with hardware acceleration – Richie Frame Nov 18 '20 at 23:30
• @RichieFrame that is completely true. Actually, one needs to write a code to see the actual power. I didn't use this since even the runs of OpenSSL vary. Maybe in little later I need to implement. Thanks. – kelalaka Nov 19 '20 at 14:04