Formula & Calculator
Brute-Force Key Space Cracking Time Estimate
Estimates the average time required to brute-force a cryptographic key or password of a given bit strength.
Interpretation
Brute‑force cracking time estimate: Time = 2^(bits−1) / Guesses per Second, assuming on average half the keyspace is searched. Example: 40‑bit key, 1e9 guesses/s → time = 2³⁹ / 1e9 ≈ 549,755,813,888 / 1e9 ≈ 550 seconds (~9 minutes).
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| Time | Average cracking time | s |
| bits | Key/password entropy | bits |
| Guesses per Second | Attacker's guessing rate | guesses/s |
What it means
This formula estimates the time required to brute‑force a cryptographic key of a given bit length, given a certain number of guesses per second. On average, the attacker will find the key after searching half of the keyspace, so the time is 2^(bits−1) / guesses_per_second. For a 40‑bit key, which has 2^40 possible combinations, the average search is 2^39. At 1 billion guesses per second, the time is about 550 seconds. This illustrates why modern encryption uses at least 128‑bit keys (2^127 attempts is infeasible). The formula is useful for understanding the security strength of cryptographic systems and for selecting key lengths. It also highlights the importance of using strong, unpredictable keys and high‑entropy passwords. In practice, attackers may use faster hardware (GPUs, ASICs) or parallel computing, so the guess rate can be much higher. The formula is a simplified model; it ignores overhead and assumes exhaustive search is the only attack. It remains a basic tool for security analysis.
Worked example
Brute‑Force Cracking Time – Two Examples
Real‑World| Parameter | Value |
|---|---|
| Bits | 56 |
| Guesses/sec | 1×10⁹ |
| Parameter | Value |
|---|---|
| Bits | 128 |
| Guesses/sec | 1×10¹² |
Common mistakes
- Factor 2^(bits−1): This assumes on average half the keyspace is searched before finding the key.
- Guesses per second: Depends on hardware (e.g., GPU, ASIC) and hashing algorithm.
- Units: Time is in seconds; convert to minutes/hours/days as needed.
- Key bits: The exponent is bits−1 because the expected search is half the total keys.
- Parallel attacks: Multiple machines reduce the time proportionally.
Applications
Brute‑force cracking time estimate, given by `Time = 2^(bits−1) / guesses_per_second`, estimates the time required to exhaust half the keyspace in a brute‑force attack. This formula is used to assess the security of cryptographic keys, passwords, and tokens. Engineers use it to set key lengths, to determine the feasibility of attacks, and to compare different encryption algorithms. In practice, it helps in designing systems that are resistant to offline attacks, by ensuring that the cracking time exceeds the useful lifetime of the data. Understanding this estimate is crucial for security professionals in justifying the use of longer keys and stronger algorithms.
- Cryptographic key length selection
- Security risk assessment of encryption schemes
- Design of authentication tokens and session IDs
- Performance evaluation of hashing algorithms
- Compliance with security standards (e.g., NIST)
Frequently Asked Questions
The average time to find a key by brute force (assuming half the key space must be searched) is Time = 2^(bits‑1) / Guesses per second, where bits is the key length in bits, and Guesses per second is the number of keys that can be tested per second by the attacker.
The number of bits is the entropy (or key length) of the secret. For a symmetric key of length 128 bits, the key space is 2^128. The formula uses 2^(bits‑1) because, on average, you find the key after searching half the space.
- Assuming a linear relationship between bits and time – each additional bit doubles the time (exponential).
- Using the wrong average factor – the average is 2^(bits‑1), not 2^bits.
- Not accounting for parallelization – if multiple machines work together, the effective time reduces linearly.
- Assuming the attacker has maximum speed – in reality, the number of guesses per second depends on hardware (CPU, GPU, ASIC).
Time = 2^(128‑1) / 10^10 = 2^127 / 10^10. 2^127 ≈ 1.7×10^38. Dividing by 10^10 gives 1.7×10^28 seconds, which is about 5.4×10^20 years – astronomically long. Thus, 128‑bit keys are currently unbreakable by brute force.
Increasing the key length by one bit doubles the cracking time (on average). For example, from 64 bits to 65 bits, time doubles. This exponential growth is why long keys are secure.
The "Guesses per second" can vary widely: a modern CPU might do 10^9 guesses per second for some hashes; a GPU can do 10^10; specialized ASICs (like Bitcoin miners) can do 10^12 or more. The time is inversely proportional to this speed.
Brute force tries every possible combination of characters. Dictionary attack uses a list of likely passwords (common words, variations). Dictionary attacks are much faster if the password is weak. Entropy helps protect against brute force, but not against dictionary attacks if the password is common.
Salting makes pre‑computed rainbow tables useless. Hashing algorithms like bcrypt or PBKDF2 add a work factor (iterations), which increases the time per guess, effectively reducing the "Guesses per second." This makes brute‑force attacks much slower.
Time = 2^(56‑1) / 10^6 = 2^55 / 10^6 ≈ 3.6×10^16 / 10^6 = 3.6×10^10 seconds ≈ 1140 years. This is why 56‑bit DES is considered insecure; it was broken in 1998 with dedicated hardware.
- Security audits – estimating the strength of encryption.
- Password policy design – setting minimum length and character requirements.
- Cryptographic algorithm selection – choosing key lengths (e.g., AES‑128 vs AES‑256).
- Legal and forensic estimates – estimating time to break encryption.