Skip to content

ascii_printable_visible#28

Open
jjb wants to merge 3 commits into
ruby:masterfrom
jjb:ascii_printable_visible
Open

ascii_printable_visible#28
jjb wants to merge 3 commits into
ruby:masterfrom
jjb:ascii_printable_visible

Conversation

@jjb

@jjb jjb commented Apr 22, 2024

Copy link
Copy Markdown

A method to generate from more or less the entire "typable" space.

This is the sort of thing I might use if I need to generate a random password for a user.

I tried to name it in order of increasing specificity. maybe the name should be nicer to type.

I think the regex in the test is correct.

I implemented it using alphanumeric instead of choose to avoid repeating code.

Let me know what you think!

https://www.ascii-code.com/

see also: #3

Comment thread lib/random/formatter.rb Outdated
Comment thread lib/random/formatter.rb Outdated
jjb and others added 2 commits April 22, 2024 02:33
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
@jjb

jjb commented Apr 22, 2024

Copy link
Copy Markdown
Author

@olleolleolle thanks!

@jjb

jjb commented Apr 29, 2024

Copy link
Copy Markdown
Author

@nobu @hsbt what do you think?

@nobu

nobu commented May 18, 2024

Copy link
Copy Markdown
Member

What do you intend by “printable visible”?
Doesn’t “visible” imply “printable”?

@nobu

nobu commented May 18, 2024

Copy link
Copy Markdown
Member

Random::Formatter#alphanumeric was designed so that any character set can be used as an option..
To be honest, I don't think it's a good idea to add methods for every possible character set.

BTW, I think !..~ is called a "graph" in C and POSIX terminology.

@jjb

jjb commented May 18, 2024

Copy link
Copy Markdown
Author

What do you intend by “printable visible”? Doesn’t “visible” imply “printable”?

“Printable” comes from the ascii spec

here I include everything in that range except for white space

happy to use a different name!

To be honest, I don't think it's a good idea to add methods for every possible character set.

sure - my proposal is just an idea for what is a common need for me and I thought maybe others. To generate a secret string with letters, numbers, and symbols. For example to meet password requirements.

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