# Time taken for a brute force attack on a key size of 64-bits

You can do $2^{30}$ encryptions per second and the key size is 64 bits.

$2^{64}/2^{30}$ should give me the time taken for a brute force attack? What if you double the key size?

How can I calculate the maximum and average time taken for such an attack.

• Hints: brute force attack is trying keys, until finding one that matches. We can try them by increasing order. Trying involves one encryption with the key tried, and then a comparison of comparably small cost, and (if there's a match, that is, rarely) some confirmation operation. If a key has $b$ bits, how many possible keys are there? What's the time to try them all at a rate of $r$ keys per second? For the average time, you can compute the average of the exact time over all possible key values, or use a well-known approximation.
– fgrieu
Apr 15, 2016 at 5:23

Well, that's simple: $$2^{64}/2^{30}$$ is indeed correct. And since $$2^{64}/2^{30} = 2^{64 - 30} = 2^{34}$$ then that would be the answer. A simple recalculation would give you approximately 545 years. As you can see, 64 bits is pretty much on the border of being cracked by general computers. It is also about the same size as the SHAttered attack; these kind of attacks scale well, so just renting 640 cores for a year in a cloud service would probably do it.
The calculation required to find out the time it takes to brute force a 128 bit key isn't that more complicated: $$2^{2 \cdot 64}/2^{30} = 2^{128}/2^{30} = 2^{128 - 30} = 2^{98}$$. The outcome of course is rather different though; you'd now need $$10^{22}$$ years. Or around 700 billion times the current life-time of the universe to try all the keys. Or 350 billion times the life of the universe if you average things out (yeah, right).
Then again, according to WolframAlpha $$10^{22}$$ years is only 3.3 times the half life of Calcium-76 so there may be some calcium atoms left to witness the end result. Again, you can drastically reduce the time by adding processors. However, you'd need too much processors and energy to bring it back to a value that is possible to crack in a life time. Better not try to brute force a properly randomized 128 bit key then.