Skip to content

Conversation

@ZeroBug-ZB
Copy link

No description provided.

@sindresorhus
Copy link
Owner

What does “printable characters” refer to exactly? And what’s the use-case?

@ZeroBug-ZB
Copy link
Author

Printable chars are characters that can be displayed, you can read more here: https://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

They are used during the generation of a random password (password recovery for example), where it is necessary to generate and email a password with printable characters.

When generating a password it is good practice to use all possible characters and not restrict to "a-zA-Z0-9!$%&@#", since it is saved (and compared) as a hash it is not necessary to filter the chars to be "safe".

@sindresorhus
Copy link
Owner

Should be asciiPrintable then? Printable character in general could be any character that is not invisible, including emoji.

You also need to update the readme and the TypeScript definition.

@sindresorhus
Copy link
Owner

@stroncium Thoughts on this?

@stroncium
Copy link
Contributor

+1 on ascii-printable instead of printable

-1 on general idea:

  • when integrating with random libraries/checkers out there, it can easily hit limits on some(not so well thought of) checker
  • printable set is 1.5 times bigger than base64 set, not much of a difference in the end, but base64 is more readable and already is there.
  • if we speak about entropy strings which might be shared via various mediums(like passwords), it is considered a bad idea to generate strings of random printable characters, as some of them can be confusing/indistinguishable when wrote down on paper/spelled out

So, if we were to introduce something to generate full random passwords, we might just go for it and make a good generator, not the most primitive thing.

@ZeroBug-ZB
Also, it's kind of abstract critics, but I'm so damn tired of the way people handle password all around I owe myself to speak out: random character strings are bad passwords. Easy explanation: https://xkcd.com/936/
Shameless advertising: https://github.com/stroncium/node-xkcdpass (but there is a couple more of implementations for js, as far as I recall)

@sindresorhus
Copy link
Owner

sindresorhus commented Nov 16, 2019

@ZeroBug-ZB Can you rename it to ascii-printable? And also update the readme and the TypeScript definition.

@stroncium I agree with you. I still think this mode could be useful for other things though. After merging this PR, maybe you could submit a PR to recommend https://github.com/stroncium/node-xkcdpass for generating passwords.

@sindresorhus
Copy link
Owner

@ZeroBug-ZB Bump

@sindresorhus
Copy link
Owner

#20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants