In thesis...
If your encryption algorithm accepts them, any data printable should be able to be part of a password, the rest is service policy.
Defining a Service Policy
You need to define a service policy to avoid strange behaviors like:
- trimming of passwords
- accept control characters as Ctrl+Backspace in Windows. Some are printable like the one I mentioned
- automatic behaviour caused by spell checkers or virtual keyboards such as smartphones.
Passwords: hard to break is different from being hard to remember
To help you define your policy, read this article by Jeff Atwood, co-founder of Stack Overflow, "Password Rules Are Bullshit". He cites the most common problems of the rules that most websites adopt and how to bypass them.
Processing time and CPU usage
To define your service policy, you can use as argument the processing time and CPU use, since encrypting a data of 100 Kb should not cost the same as a 3 Mb.
This is why some services limit the password to 32 characters, for example.
Copy and paste
What can harm usability is the copy-Paste of passwords, since with spaces there is no way to distinguish:
Sua senha é <b>darthépaidoluke</b>
Sua senha é <b>darthépaidoluke </b>
How will the user differentiate these two after rendered? There is no way to know where these spaces end.
This is another reason not to accept spaces.
The sound of the keys
In terms of information security, some say that space has a distinguishable sound on the keyboard, (extra!), so it shouldn’t be accepted or anything. If the attacker can hear the sound of the keyboard, it is much easier to break the password if he knows it follows the pattern
XXX__XX
X: qualquer outro caracetere
_: espaço
Okay, I don’t want to accept spaces in passwords. And now?
You can show a validation message saying that you don’t accept spaces or trimming spaces (strategy that Google uses).
I understand that not using spaces can decrease the sample field of password possibilities, but allowing them can cause the user to enter a space unintentionally. That’s right! Unintentionally. The mobile web experience is good, but not perfect yet.
Particularly, and defended by UX, I don’t like the idea of doing Trim. Alert the user and ask for correction.
Also do not include 1,000 different rules for creating a password, this can harm usability. Large applications use on average 3 constraints at most.
As a power meter, one of the parameters can be how much effort a computer would take to crack such a password (!)
I think this is very relative. It will depend on the programmer. I find it very difficult to put spaces in the ends of the password. Sounds like something you don’t know about the Internet or password systems. And even so, most systems already inform how the password should be: "first letter uppercase, must contain at least 1 number etc"..
– Sam
NIST itself, which previously recommended a "singing and dancing" password, went back: https://www.passwordping.com/surprising-new-password-guidelines-nist/ ; xkcd was already saying that a strong password is a high entropy password for a long time: https://xkcd.com/936/ ; then, yes, allow different characters influence the password, and this should include space, not to mention that spaces increase the password size and therefore the set possibility to be broken in brute force. Limit not having spaces at the ends decreases sub-exponentially the search space
– Jefferson Quesado
Note that I did not suggest removing spaces on the ends because of the password, it was only for counting the string size.
– Sam
@dvd true, I hadn’t realized it before. I need to rephrase the question, I’ll see what I can quickly
– Jefferson Quesado
If the user typed 6 blank spaces, the password would be validated by size, that’s what I meant
– Sam
@dvd in this case, we have low entropy of the password bits. What would be what xkcd argues against
– Jefferson Quesado
I see no reason to limit passwords. If we limit the use of blank spaces at the end of passwords we would have to inform the user, consequently someone malicious would have important information about how your password system works.
– Phelipe
Just remembering that client-side validation is visible, whichever rule, anyone can see the requirements.
– MagicHat
I believe if you limit the subset of characters, one has to consider the means of entry, not the "classification" of the symbols themselves. For example: If I use the character, I will be able to log in to a different keyboard or device?
– Bacco
@Bacco , a very valid concern of UI. I had not thought about it before. I believe Maniero mentions this fact in his reply
– Jefferson Quesado
May I have the honor to know why the negative? I wish I could improve
– Jefferson Quesado
How about: "Allow or not allow the use of accentuation in passwords?". Or else, "Allow or not allow the use of the letter P in uppercase passwords?". Note that both yours and these other questions engage more in technical than UX discussions. From the point of view of the user (UX, right?), we should allow the user to put the password devil he/she wants. After all, the password is his(a) and it is he(a) who will have to remember it. :)
– Luiz Vieira
@Luizvieira, in the event that it is known, a priori, that it is common for the user to use as input devices other than our usual QWERTY keyboards, would this come only as a technical question? It would not involve greater UX depth for the various platforms?
– Jefferson Quesado
It certainly would. But even mobile virtual keyboards have the space key, so my comment remains valid. If any device does not have a keyboard (physical or virtual), then the discussion should be different: maybe the use of digitable passwords is not appropriate from the beginning.
– Luiz Vieira
In fact, a virtual keyboard means one that the user can type in it in a simulated way (touching the screen, for example). A virtual keyboard on a TV where the user needs to navigate between the QWERT keys using an arrow is something totally tiresome and inefficient. So services with Youtube and Netflix tend to completely avoid password on these devices (using, for example, a Qrcode to sync based on another device where it is possible and comfortable to enter password).
– Luiz Vieira