4

Earlier, I went to a site that required a number and special character, and it got me thinking – wouldn't that make the password easier to brute force? If you assume most passwords have around 12 characters, wouldn't requiring a number remove about 90% of the possible passwords, making brute force much faster?

B-Con
  • 1,882
  • 12
  • 19
tkbx
  • 171
  • 4
  • 1
    You forget the chance of a number or character being in a specific position is the same about ( 1:58 ) this is spread across each position ( 12 characters ) I won't perform the math but the password is not made "easier" to bruteforce by having a number required in the password. At the end of the day its unlikely a good 12 character password would be bruteforced anyways. – Ramhound Feb 08 '13 at 12:25
  • Isn't this a duplicate of http://security.stackexchange.com/q/7198/13909 – MCW Feb 08 '13 at 17:33
  • 1
    @MarkC.Wallace they both have to do with passwords, that's the only similarity I see. Considering this is the security site, I'd say two questions about passwords are okay. – tkbx Feb 08 '13 at 18:01
  • 1
    Requiring a number in a 12-character password randomly generated from ASCII printable symbols removes 26% of randomly generated passwords (85/95)**12. (There are 95 printable ascii chars, and 85 of them aren't numbers; so the chance they all are not numbers is 85/95**12.) This barely makes a dent in the entropy - changes from ~78.8 bits to ~78.4 bits. – dr jimbob Feb 08 '13 at 18:30
  • I don't see the difference; they're both questions about how significantly a given constraint on password complexity raises the risk. As you say, they're both on topic, but I think the answers are the same. (which is to say, mathematically, yes, practically, no.) – MCW Feb 08 '13 at 18:42

4 Answers4

8

It removes a lot of passwords only if you consider that all combinations of 12 letters were possible passwords. In practice, users don't consider random passwords; they want to use passwords with a meaning and there are not many of those.

In other words, what matters is not the number of passwords which fit into the password entry field, but the number of distinct passwords that the user chooses among (the "generation process"). Requiring an extra digit enlarges that space for most users. Users for which the forced digit reduces the space of possible passwords are users who choose really random passwords, and even at 11 letters and 1 digit, these will be strong.

Thomas Pornin
  • 326,555
  • 60
  • 792
  • 962
4

From a purely theoretical standpoint, yes. The set of all strings of a given length will be larger than the set of all strings with any further restriction on them.

But the bank is gambling that the space of passwords that the user would practically choose from is actually much smaller than the set of all possible passwords, and that by mandating a number and special character they are increasing the set of passwords the user will choose from since the user may not have included those restrictions on their own. (All other things equal.)

And while a reasonable percentage of the available passwords will indeed be eliminated by the requirements this doesn't really matter, practically or theoretically, because password strength is measured logarithmically and 90% doesn't change a lot on the logarithmic scale. Assuming that the set of passwords with restrictions is only 90%* of what it could otherwise have been, this is only a difference of about 3.3 bits of information. At a length of 10 total characters and about 72 possibilities per character (52 alphabetic, 10 numbers, and 10 special characters), the set of all possible character strings has about 63 bits of space. So with the restrictions we have 59.7 bits of password space instead of 63 bits. Not a big deal.

(* The OP's 90% estimate is a very large over-estimate for how much the password space is reduced. See these comments or other answers for better approximations of how the password space is actually reduced.)

B-Con
  • 1,882
  • 12
  • 19
  • But realistically, aren't almost all password breaches either brute force (number of characters being the only factor), or social engineering (the password itself not being a factor)? On the off chance that someone could guess someone's password, couldn't they guess it just as easily with a 1 at the end? – tkbx Feb 08 '13 at 02:00
  • 3
    For not too short passwords dictionary based attacks (words from some dictionary plus combinations and variations thereof) are more important than brute force trying any character combination. – mkl Feb 08 '13 at 10:25
  • @B-Con - The actual calculation is straightforward to do; and shows the requirement of a number eliminates about 26% of password; reducing the entropy by about 0.45 bits – dr jimbob Feb 08 '13 at 18:34
  • @drjimbob: It's worth noting that my assumptions and yours differ on password length and character sets, and yours shift the calculation towards less entropy loss. My agreeing with 90% was more targeted at worst case for password lengths and restricted character sets. – B-Con Feb 08 '13 at 19:23
  • @B-Con - If your symbol set with numbers is 72 chars, the chance any given character is a non-number is 62/72 ~ 86%. The chance that all 10 chars in the pw not being numbers is (62/72)^10 ~ 22%; quite different from 90%. (To get about 90% reduction, your password length would need to be about 1). The new password space then shrinks by 22%, so is (1-22%) of the original and since lg(xy) = lg(x)+lg(y) that means the entropy decreases by 0.4 ~ -log(1-.22) bits. – dr jimbob Feb 08 '13 at 19:54
  • You forgot to account for the special character, (52/72)^10 = 3%. But 3% tells us little about passwords containing both. Instead, I was interested to note that giving the mandatory characters fixed positions gave a trivial lower bound of (10/72)^2 = 0.02 = 2% (since they are not actually fixed it will obviously be much greater) and ln(.02) is -3.9, so we can't lose more than about 4 bits. Since that is probably negligible, almost any estimate is in the right ballpark. The takeaway was that it doesn't matter what the exact restrictions are in this type of case, the impact is negligible. – B-Con Feb 08 '13 at 21:05
  • @B-Con - First, use base-2 log (lg) to calculate informational entropy lg(0.02) ~ -5.6 bits. Next, OP claimed "wouldn't requiring a number remove about 90% of the possible passwords", which is wrong -- it removes ~25% (0.5bits) of the passwords using his assumptions. Third, there's 33 keyboard symbols but if you imagine only ten (why?), requiring a number and symbol reduces 72^10 to 72^10-62^10-62^10-52^10, or a reduction of 1 bit. Allowing 33 spec chars it reduces from 95^10 to 95^10-85^10-62^10-52^10 (0.6 bits). At 12-chars (password length OP assumes) this reduces by ~0.45 bits. – dr jimbob Feb 08 '13 at 22:32
  • You're right, I hit the wrong log. 2) Probably not what was meant, since it was the numbers and special character restriction they actually encountered, so I'd think that's what they're interested in. 10 is because many password requirements restrict the special characters allowed in passwords, with verbage similar to "only numbers, letters, and - , _ . + are allowed". I've seen even fewer than 10 special characters permitted. 3) Very true, it is indeed a simple calculation. Remember inclusion/exclusion, though, the (-62^10-62^10-52^10) is double-counting. (Doesn't effect much, though.)
  • – B-Con Feb 08 '13 at 23:34