Adjusting with Moore's Law

In my last post I used zxcvbn to check the strength of passwords, and it gave estimates in hundreds of centuries.

However, there's Moore's law. If we assume that every 18 months the effective computing power will double...

#!/usr/bin/python3

import sys

years = int(sys.argv[1])

# How many 18 months intervals we spent
count = 0
# How many original-computation-time-months we compute each 18 months interval
step = 18
# How many original-computation-time-months we computed so far
total = 0
# How many original-computation-time-months we need
target = years * 12

# Iterate each 18 months interval
while True:
    count += 1
    total += step
    if total > target: break
    step *= 2

print("{:.2f} years needed".format(count / 12 * 18))

...then something that is now estimated in 152 centures is likely to take, well:

$ ./actual_years 15200
9.33 years needed

Update

Fixed algorithm (thanks John MacGregor). Now the estimate is a little longer, but still:

$ ./actual_years 15200
21.00 years needed

Łukasz Stelmach proposed an analytic solution:

There are two cars (remember phisics in primary school?). They both have the same speed V0. It is going to take "54.697 centuries" for car A to travel the desired distance at constant speed. Car B is accelerating, its speed is 2^(t/18m)*V0 (18 [m]onths).

s = V0 * T (car A, T is 54.697 centuries)

s = ∫2^(t/18)*V0 dt (car B, we're looking for t)

It's been some time but as far as I can tell it is

s = V0 * 2^(t/18) * 1/((1/18) * ln 2)

2^(t/18) * 1/((1/18) * ln 2) = 54.697 * 100 * 12 [months]

2^(t/18) = 2527.54

t = 18*log2(2527.54)

t = 16.96 years (still reasonable strength).