The general wisdom has always been and appears to remain, that using special characters in passwords is very, very good. The more, the merrier!
Respectfully, I disagree.
The strength of a password is generally characterized by the number of guesses that, on average, a potential attacker has to make before arriving at the correct password. It is on that basis that ‘12345’ is commonly regarded as the worst password imaginable, as it is quite obviously the first password a potential attacker will try. This characterization is purely statistical, though. At any moment, world’s luckiest attacker can guess your 50-character password first try. This is astronomically unlikely, but is also never impossible.
What we therefore do by increasing password complexity, is the only thing we can do, which is minimize the probability for a potential attacker to guess a password correctly. We do this by maximizing the number of passwords our password could possibly be one of, and that is done in turn either through increasing password length or extending the set of symbols used to generate the password.
Random vs. Non-Random Passwords
It’s worth noting at this point, that I will only be talking about randomly generated passwords, which are by far the most secure if generated with a cryptographically secure source of randomness. Using any data at all to construct your password (including, but not limited to: real or fictional words, usernames, addresses and birthdays) is categorically unsafe, because all it does is narrow down the set of passwords that your password could possibly be one of, compared to a randomly generated password of the same length.
You could use a longer non-random password to match the level of security provided by a randomly generated password. But that quickly becomes very hard to analyze: what if, for example, you created a numeric 16-symbol password out of the numbers of all the flats and houses you’ve ever rented, in chronological order? Assuming these numbers are random and not dependent on each other, this password might seem quite good on the surface. A cryptography expert might try and analyze it as if it was a randomly generated password, and find that it contains 53 bits of entropy. But then, there are only 5 to 8 flat/house numbers this password is constructed out of. For the sake of an argument, let’s average that out to 7. For an attacker that possesses the full set of those numbers, the complexity of the password is then potentially reduced to 12 bits of entropy. Which, in decimal terms, is 12 orders magnitude less secure.
Which interpretation is more correct? The answer is, it depends on the probability that the attacker possesses the knowledge which reduces the password complexity. And, if you think about it, this probability is almost always quite high for the things people want to actually use in their passwords. The example I’m using is actually one of the better ones, because only you (and maybe your government) will only ever realistically be in possession of the full list of places you’ve rented. But as people tend to use public information in passwords more frequently than not, the security of a non-random password is almost always greatly reduced compared to a random one.
Special Characters and Powers of Sets
Once you’ve generated the password that you want to use, the only number that realistically matters, in terms of password security, is the total number of possible passwords you could have generated instead. And at that point, it does not matter whether or not you’ve used special characters. A 5-character password with special characters is bad, and a 50-character password without special characters is still extremely good. But a question then arises: where exactly is the line between good and bad? Luckily, in this particular case, the answer can be derived mathematically.
The total amount of passwords world’s unluckiest attacker (which would need to guess all other possible random passwords of the same length before guessing yours) would need to go through to guess your password is approximately
N≈C^k
where C is the number of symbols each individual character could be (i.e. the number of elements in the symbol set), and k is the length of the password. By going through this many passwords, if they’re all k characters in length, an attacker will have exhausted all possible k-character combinations of the symbols that you’re working with.
The average number of passwords a real attacker would need to go through is, of course, approximately half of N.
For a real attacker that doesn’t know the length of your password, it also makes sense to first go through all of the passwords of smaller length. But the number of passwords that are one character shorter than yours will be C times smaller. And the number of characters that are two characters shorter is C2 times smaller.
As C is usually larger than 50, the only quantity that reasonably mattets is the first improvement upon the approximation, which is N/C. The subsequent improvements will be negligible. Therefore, if C is larger than 50, then N/C is no more than 4% better than N/2. I find this improvement not worth the apparent complexity it introduces into the calculation, so I will be using the approximation which disregards the need to check smaller password lengths.
For alphanumeric characters, C=C_0=62. For alphanumeric and special characters, C=C_1=94. It thus transpires that for a given password length k,
N_0≈62^k
N_1≈94^k
It is true that for a fixed character length, using special characters will always be better for password security, which is illustrated by the above equations. It is equally true, however, that the length of the password without special characters can always be increased, so that it matches the strength of the password with special characters:
N_0=N_1
62^k_0=94^k_1
k_0=log_62(94^k_1)
k_0=k_1*log_62(94)
k_0=k_1*[log(94)/log(62)]
But surely, surely, you will need to increase the length, like, by a lot? You would think that, since 94 is so much bigger than 62, about 1.5 times bigger in fact, using special characters would be so much better, right? Right? Right? Well, we can, in fact, compute the exact factor of length increase:
log(94)/log(62)≈1.10083≈110.1%
Soo… According to the math, to match the strength of a password with special characters, you need to add… 10.1% more characters? That’s like… 3 characters for a 30-character password? And if you just use a 30-character password without special characters, it will be the same as using… a 27-character password with special characters? What fun.
I don’t know about you, but I don’t think this 10% extra protection is worth having your password be a bunch of mess that’s even more unintelligible than random letters and numbers. It’s harder to learn, harder to remember, and seems to be downright pointless. At least, I think that’s the case. As always, I encourage you to make your own judgement call.
Regardless, though, I find websites requiring you to have special symbols in your password extremely annoying and basically useless. Most passwords, realistically, will be less than 16 characters in length, and at that point, adding a special character only affords you no more than 1.6 extra characters of security. Oh hooray.
This rant was originally published (in slightly different wording and with ever so slightly different numbers) on GitHub on February 20, 2025

Leave a Reply