# How do we estimate the time taken to crack a hash using brute force techniques

A German hacker famously managed to brute force crack a 160 bit SHA1 hash with passwords between 1 to 6 digits in 49 minutes. Now keeping everything constant (hardware, cracking technique - here brute-force, password length etc.) let's say it takes 1 hour to crack a SHA2-256 bit algorithm (the time taken is just an example, I know that's not the case currently) then how do we estimate the time taken to crack the SHA-512 hash or the SHA2-384 or SHA2-224 hashes?

The hash type is also an example, an other way of asking this question is if it takes 1 hour to crack a hash of 128 bits, how do we arrive at a formula to estimate time to crack the same hash type but of a different bit strength, everything else staying constant?

For hashes with no attacks beyond brute force, cracking time is:

``````keyspace / hashrate
``````

A six-digits-or-less password has a keyspace of 1,111,111 possible values, so a hashrate of 377 hashes per second is sufficient to crack it. Now, for a modern computer, that's exceptionally slow (the sort of hash rate you might expect from an Apple II), and wouldn't be worthy of note. The article is actually about passwords of 1 to 6 characters: assuming alphanumerics, that's 6.2*10^10 possible values for a more impressive 21 Mhash/sec; if it's bytes, that's 93 Ghash/sec.

SHA-512, SHA2-384, and SHA-224 aren't much slower to compute than SHA1 or SHA-256, so if you can brute-force a SHA1-hashed password in an hour, you can brute-force it in about an hour if one of the other SHA hashes is used instead. This is why passwords should be hashed using an inherently slow algorithm such as bcrypt.

• Thanks, the formula was useful although are you sure that SHA2 algorithms and the bit levels won't have an impact on brute force timelines? Then whats the point in using the sha2 series? Wow, i expected more variables here. I guess I have a lot more reading to do! May 23 '14 at 17:29
• The SHA family of hash functions are designed to be computed quickly. One result of this is that output length has minimal effect on the speed of computation. The advantage of the SHA2 series, and especially the longer bit lengths, is attack resistance in the generalized case, when inputs can be arbitrarily large. In a constrained-input case such as a short password, there's not much difference between them.
– Mark
May 23 '14 at 19:20