Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the best rules to follow for what characters to allow in a password?

Without thinking about it at all I just want to say I should allow every character. It gets hashed in any case, and I don't want to limit people who want to create strong passwords.

However, thinking about it more, there are plenty of characters that I have no idea what effect they'd have on things. Foreign characters, ascii symbols, etc. to name a couple.

I tried to Google but I can't find any definitive standard for what people do. Even most professional organizations don't seem to know. It seems to be a common practice for many sites to disallow special characters altogether, which is just silly and not what I want to do.

Anyway, are there any standard recommendations for length, allowed characters, and so forth?

I'm not sure if it matters, but I'll be using ASP.NET w/ C#

like image 677
Gene Roberts Avatar asked Dec 21 '08 13:12

Gene Roberts


3 Answers

Any printable, non-whitespace ASCII character (between 33 and 126 inclusive) are typically allowed in passwords. Many security professionals (and SO commenters) are advising the use of a passphrase in place of a password, so you'd have to allow spaces. The argument is that due to their length, and since phrases aren't in a dictionary, passphrases are more difficult to crack than passwords. (A passphrase can also be easier to remember, so a legitimate user doesn't have to keep it written down on a sticky-note right on their monitor.)

Some strong password generators use a hash, so I'd put a very high limit on the length (512 or 1024) just to be inclusive. Password generators today often yield strings of 32-128 characters, but who knows what hashes will be used in the next few years.

like image 57
Bill the Lizard Avatar answered Oct 29 '22 17:10

Bill the Lizard


Non-ASCII characters certainly make things harder when it comes to entering the password on limited devices (mobiles, consoles etc) - but usually not impossible. Arguably if the user wants to do that, you should let them. It's easy enough to do a reasonable and consistent thing - encode in UTF-8 before hashing, for example. You'd only get into difficulties if some input device sent the characters as a composition (e.g. e + acute accent instead of "e acute") - but I suspect that wouldn' t happen in real life. (You could decompose everything yourself, but that would be a lot of trouble to go to for an edge case.)

I'd restrict it to printable characters, however. Putting tabs, form feeds etc in a password really is asking for trouble.

like image 43
Jon Skeet Avatar answered Oct 29 '22 17:10

Jon Skeet


Not an expert, but I hate when characters I choose and not that bizarre are rejected. So, I think I agree with your gut.

like image 24
kenny Avatar answered Oct 29 '22 15:10

kenny