Estimate the time required to brute-force a password or key given attempt speed.
The total keyspace an attacker must search is charset_size^length. Assuming attempts are tried in random or sequential order, the average time to find the correct password is the time to search half the keyspace, divided by the attacker's guesses-per-second rate. That rate varies enormously by hashing algorithm: fast, unsalted hashes like MD5 can be attempted at tens of billions per second on modern GPUs, while deliberately slow, memory-hard algorithms like bcrypt and Argon2 are designed to make each guess computationally expensive, dropping the achievable rate to thousands or even hundreds per second.
Total keyspace
combinations = charset_size ^ length
Average crack time
time = (combinations / 2) / hash_rate
MD5 and SHA-256 are designed to be fast, which is exactly the wrong property for password hashing — it lets attackers try billions of guesses per second on GPUs. bcrypt and Argon2 are intentionally slow and memory-hard, cutting achievable attack rates by 6-7 orders of magnitude.
If an attacker searches the keyspace in a fixed order (or randomly without repeats), the correct answer is, on average, found after checking half of all possible combinations — not all of them, and not just one.
Each additional character multiplies the keyspace by the charset size, so going from length 8 to 9 with a 62-character set multiplies crack time by 62x — length increases have an exponential, not linear, effect on brute-force resistance.
No — this models pure brute-force search across the full keyspace. Real-world attacks often succeed much faster using dictionaries, common password lists, and mutation rules that target likely passwords first rather than searching randomly.