# How to calculate time needed for decryption of 64-bit key

I am having trouble figuring out how long it takes to decrypt a 64-bit key, given that a computer can do 1 billion trials per second. I know that there are $$2^{64} = 1.844 \times 10^{19}$$ possible keys for this key size, but then how do I go about figuring out the rest? If there is a formula for this, I would be very curious to know what it is.

• You know the number of possible keys, and you know how many keys per second the computer can attempt. Can you not figure out the average/worst case times? Hint: you know K and K/s, and you need to figure out s
– Marc
Sep 9, 2020 at 20:48
• @Marc I think maybe I'm really overthinking this and I just need to divide the number of keys by 1 billion? Sep 9, 2020 at 21:30
• For the worst case, yes. I'll let you work out the average case, don't overthink it.
– Marc
Sep 9, 2020 at 21:37
• Math tip: this is much easier if you stick to powers of two and use the laws of exponents. A billion is $2^{30}$ plus change. So trying $2^{64}$ keys at $2^{30}$ keys/second is just a division. And since we've expressed everything as powers of two, we can do it by subtracting exponents: $2^{64} ÷ 2^{30} = 2^{64 - 30} = 2^{34}$ seconds, which is $2^{4 + 30} = 2^4 \times 2^{30} =$ about 16 billion seconds and change in the worst case. Average is half that. Sep 9, 2020 at 22:28
• I'm surprised no one pointed out that we don't decrypt keys, we decrypt a ciphertext by trying all possible keys. The method is known as brute-force.
– tum_
Sep 10, 2020 at 6:59

You need to benchmark the number of keys per second on your own system to know the time it would take for you. If you can calculate half the keys, it takes twice as long. If your system calculates 10 trillion keys/sec it would take only $$\frac1{10}$$ the time (10.675 days average, 21.35 days max). I think you get the picture.