# How long would it take to brute force a 32 or 16 bit integer and which type of processor would brute force this in the shortest period of time

I was actually wondering... How long would it take to crack/brute force a 32 bit key/encryption and a 16 bit key/encryptions respectively on a 4GHZ and a 2GHZ PC. I know that a 32 bit integer has 4,294,967,296 combinations while a 16 bit number has exactly 65,536 combinations but I don't know how long It'll take. and what processor would be able to brute force this in the shortest period of time

• probably less than a second on any modern system, hell a smart phone could do it in under a second i bet. Oct 12 '20 at 23:35
• @RichieFrame Even an Intel 4004 could "break" a 16-bit integer in the blink of an eye. Oct 13 '20 at 0:42
• @forest I am making the assumption that a key scheduling algorithm needs to be run for each key, in the context of an algorithm that uses 32-bit keys, or a truncated key for AES Oct 13 '20 at 19:54

$$4,294,967,296ops/4,000,000,000ops/s=1.07s$$

$$65,535ops/4,000,000,000ops/s=16.4μs$$

2GHz twice that.

That's per-core. So 8 cores = 1/8 of a second or so. 64-core/128 thread 2GHz Threadripper = about 16ms.

A GPU will be even faster. It's recommended to brute force the entire 2^32 space for testing various numerical functions, it's fast and catches all the edge cases you might not have thought about. Brute forcing 2^64 values takes a month or so on a fast GPU, easily doable faster on a GPU cluster.

Edit, thanks to kelalaka: a Tesla V100 can run about $$2^{47}$$ SHA-1 hashes/hour. SO $$720hours/month\times2^{47}Hashes/hour\approx2^{56}Hash/month$$. That's about 182 months total, but each hash is substantially more work than just incrementing an integer, so a faster operation can likely be brute-forced in a month on such a GPU. Slower operations need a cluster, but such clusters can be rented from various cloud providers.

• Actually, for an integer that small, a GPU will be significantly slower. Oct 13 '20 at 0:41
• Do you have a reference for a (single) GPU that could make $2^{64}$ operations in a month? That seems a lot. And what kind of operation? For brute force to be a method worth any consideration, that operation must use several instructions; I can't imagine anything below 4 arithmetic instructions.
– fgrieu
Oct 13 '20 at 7:01
• Tesla V-100 working on SHA-1 does $2^{35}\,\text{Hash/second}\approx2^{47}\,\text{Hash/hour}$ [note: the present comment was edited by a moderator per the author's request; it was also removed a later comment based on the earlier, incorrect version] Oct 13 '20 at 19:25
• Per my number crunching based on a Tesla-V100 doing a reported $56\,\text G\,\text H/\text s$ on an MD5 workload, I get $2^{57}$ per month, which is reasonably in line with $2^{64}$ much simpler but still meaningful crypto operations per month. I had not realized that we reached this landmark.
– fgrieu
Oct 15 '20 at 15:48
• Also, see qberty.com/nvidia-rtx-3090-hashcat-benchmark and qberty.com/nvidia-rtx-3090-hashcat-benchmark I would not update my answer, however, you can benefit from them. Oct 15 '20 at 19:25