I've been wondering for a while now why the password generator doesn't allow me to generate truly fully random passwords. Why do I get to set the number of digits and symbols in the password? Because as it is, I've just set this to some value and don't usually change it for every password I generate.

Doesn't that take away a big chunk of randomness from my passwords?

I realize there are situations where you have to have a minimum number of symbols in your password, for example. But even then, a minimum setting would still be better than a fixed number. For most other websites a fully random setting would be totally fine.

Or maybe it's been there all along and I just managed to miss it all this time. Please enlighten me

Regards,

Moritz

This discussion has been closed.

## Comments

Team Member

First the rationale of the current system is that there are still web pages that have requirements like "exactly 2 digits" and so on. You are correct that these do, in general, reduce the entropy, but in practice it doesn't do so by much.

I've actually been trying to figure out the precise formula for the settings of "N symbols and M digits and total length L", but it is a bit trickier than I first imagined.

But lets work though a specific example. Suppose we have a password of length 15 with "exactly 2 digits" and "at least 2 digits".

In the first case, there will be 13 letters (so 52^{13} possibilities) and 2 digits (10^2) and then there will be 15 places one digit can go and 14 positions the other digit can appear. So this is a total of

52^13 * 10^2 * 15 * 14 = 4.268376911e26

That will work out to 88 bits of entropy.

The calculation for "at least 2" is trickier (at least for me). First lets start with if we have any number of digits. So this will be (52+10)^15 possibilities. But then we need to subtract out the ones that have fewer than 2 digits.

The number that could have zero digits would be 52^10. And the number that have exactly one digit is 52^14 * 10 * 15 (the last "15" is for the number of positions the digit could occupy.)

So the grand total of possibilities for "length 15, at least 2 digits" is

(52+10)^15 - 52^10 - (10*15) = 7.689097048e26

And that works out to 89 bits of entropy.

So going with "exactly 2" instead of "at least 2" we have lost one bit of entropy.

Again, I haven't worked out a general formula for this, but I've worked through the calculations with a number of plausible examples and have not found a plausible case where there is a substantial difference.

So yes, you are correct. The system in the Strong Password Generator throws away some randomness, but it turns out that it isn't enough to make a practical difference.

Cheers,

-j

As far as I understand it 10^2 accounts for all sequences of two digits, such as [3,7] and [7,3] (those are two distinct sequences that are both covered by 10^2). But when you multiply that by 15 * 14, you're actually allowing the second digit to be placed left of the first one. This would result in a different sequence of digits -- turning [3,7] into [7,3].

Basically, you're counting each sequence more than once, I think.

Of course, I have no idea how to calculate the correct number or even if this supposed error has any significant impact. You're argument might still hold.

I tried to come up with my own example, comparing a fully random 15 character password to a mixture of 5 letters, 5 symbols and 5 digits. Let's just say I failed horribly, actually ending up with a higher number for the more restricted password.

Team Member

Please see above and let me know if you have any additional questions.

It is good to know that we are not losing too much randomness from the Password Generator. However, my question still stands. I recognize the added security is very minimal, especially when adding them to ridiculously long passwords, but nevertheless I would still like to know out of curiosity. Also, what factor could vary the strength of a password when the conditions for its generation are the same? There have been times when I generated a password, when generated a password that was stronger by your scale, even though I had not changed its specifications.