def time_to_try_all(alphabet_size, length, guesses_per_second=10_000_000_000):
seconds = alphabet_size ** length / guesses_per_second
if seconds < 3600:
return str(round(seconds, 1)) + " seconds"
days = seconds / 86400
if days < 365:
return str(round(days, 1)) + " days"
return f"{round(days / 365.25):,} years"
print("8 lowercase letters:", time_to_try_all(26, 8))
print("8 mixed characters: ", time_to_try_all(94, 8))
print("12 mixed characters:", time_to_try_all(94, 12))
print("5 random words: ", time_to_try_all(7776, 5))
94 is the number of keyboard characters: 26 lowercase, 26 uppercase, 10 digits and 32 symbols. 7776 is the number of words in a common word list used for random passphrases. A password made from real names or common words falls much faster, because attackers try those first. Output (one line each): 8 lowercase letters: 20.9 seconds / 8 mixed characters: 7.1 days / 12 mixed characters: 1,508,100 years / 5 random words: 90 years