Q: Suppose an attacker knows the max allowable character length, n, for a website's passwords. Would it be smart for them to attack passwords of length n BEFORE length n - k (where k is small portion of n)?

Q: Suppose a website has max allowable password character length 32. Would it then be smart for me to choose a password of length, say, 31 or 30 rather than 32?

UPDATE: Asked another way: is there a known phenomenon of a mass of user passwords at n? And if so and knowing that, would attackers go after passwords of length n before length n - k? And if so and knowing that, would users be better to avoid passwords of length n?

  • 1
    Brute forcing 32 characters will take a while... – Mati Cicero Aug 6 '14 at 17:27
  • 1
    That presupposes knowledge of the attacker's strategy. Most real users will not elect 32 character passwords, so most real hackers will probably try shorter ones. – Eric J. Aug 6 '14 at 17:28
  • grc.com/haystack.htm has a great little utility on how long it will take to crack a password.... given enough time and computing power any password can be cracked... it is just a matter of time. St@ck0verFlow would take approximately 16.50 trillion centuries (1000 attacks per second) while stackoverflow would only take 8.20 hundred thousand centuries. – VanCowboy Aug 6 '14 at 17:32
  • 1
    @VanCowboy: St@ck0verFlow is a straightforward tweak of a common word. Guessing it by brute force would take a long time, but brute force is not necessary for straightforward tweaks of dictionary words. That site tells me password would take 6.91 years at one thousand guesses per second; apparently it doesn't use a dictionary. (The site clearly states that it is not a password strength meter.) – Keith Thompson Aug 6 '14 at 17:58
  • 1
    @VanCowboy: Off the shelf brute force hacking packages already have a built-in switch to try substitutions like St@ck0verflow when attempting dictionary attacks. It does not add much security to the password. – Eric J. Aug 7 '14 at 18:05

Assuming that the passwords must consist of printable ASCII characters (of which there are 95), the number of possible 32-character passwords is 9532 ≈ 2 × 1063.

Meanwhile, the number of 31-character passwords is 9531 ≈ 2 × 1061, i.e. about two orders of magnitude less. (In fact, they differ precisely by a factor of 95.) The number of 30-character passwords is even less, 9530 ≈ 2 × 1059, and so on. In fact, the total number of possible passwords of length less than 32 equals:

           9531 + 9530 + 9529 + ··· + 952 + 951 + 950
        = 9532 × (1/95 + 1/952 + 1/953 + ··· + 1/9531 + 1/9532)
        < 9532 × (1/95 + 1/952 + 1/953 + ··· + 1/9531 + 1/9532 + 1/9533 + 1/9534 + ··· )
        = 9532 × 1 / (95 − 1)
        = 9532 / 94

Thus, the number of possible printable ASCII passwords of exactly 32 characters is 94 times greater than the total number of such passwords of less than 32 characters. Thus, if an attacker is able to crack a 32-character password by brute force, it will take them, on average, one 94-th of the time to crack any shorter password.

Of course, this assumes that your passwords are randomly chosen out of the space of all eligible passwords. Few real-world passwords are such, but as a rough approximation, we can still assume that the amount of work needed to guess a password by brute force grows exponentially with the length of the password — the base of the exponent will just be something smaller than 95.

Also, there's nothing special about the number 32 in the calculation above. Replacing it with any other maximum length will yield exactly the same result: it's always a good idea to make your passwords as long as possible, at least up to the point where the password is long enough to make brute force cracking essentially impossible.

Where is that point? Well, the general consensus among cryptographers is that 264 ≈ 2 × 1019 brute force guesses can be done with enough effort, while 2128 ≈ 3 × 1038 guesses is probably beyond the capabilities of any currently existing or foreseeable attacker (yes, even the NSA), and 2256 ≈ 1 × 1077 guesses is definitely beyond the capabilities of mankind. The effort required to crack a random 32-character ASCII password by brute force, i.e. 9532 ≈ 2 × 1063 guesses, is between the latter two, but definitely closer (on a logarithmic scale) to 2256 than to 2128, both of which are currently regarded as unbreakable. Thus, we can safely say that, if your password is a random ASCII string, 32 (or even 31 or 30) characters is quite plenty enough.

  • So in other words, even if there were a mass of user passwords at length 32, attackers wouldn't benefit in any large way by going after length 32 passwords before length 31. And even if attackers did, users still really wouldn't be hurt by choosing (random) length 32 passwords. – lowndrul Aug 7 '14 at 15:32
  • 1
    Right. A random 32-character password isn't significantly weaker than a random 32-char-or-less password. A random 31-char (or less) password, however, is almost 100 times easier to crack than a 32-char one (although probably still plenty strong enough to resist any plausible brute force attack). – Ilmari Karonen Aug 7 '14 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.