Skip to main content

Timeline for How to generate a random string?

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Feb 16, 2020 at 10:14 comment added Dani_l @RyanKrage :graph: already excludes space, so a better solution than :print:.
Aug 15, 2019 at 12:19 comment added Ryan Krage < /dev/urandom tr -cd "[:print:]" | tr -d ' \\/\`\|' | head -c 32; echo to exclude | \ / ` and space
Mar 8, 2018 at 14:36 comment added mzzzzb < /dev/urandom tr -cd '[:graph:]'| tr -d '\\' | head -c 32; echo if you dont want ` characters in generated string. ` because is an escape character in many languages causes problems
Apr 29, 2017 at 13:54 comment added Fox Many if not most web sites have restrictions on the characters that can be in a password, so hard-coding '[:print:]' doesn't feel any better to me than hard-coding the OWASP password special character list. I feel that almost every answer here could be improved by using a variable, but that is such a minor change that I'd only suggest an edit
Apr 29, 2017 at 13:37 comment added drws @Fox His solution uses hardcoded list of characters, which is not an encouraged programming practice because of code readability, compactness and cleanliness. Also some of the special printable ASCII characters could be interpreted by bash, not to mention the most obvious drawback of his one liner - if maximum entropy is desired, can one be sure that all of the available characters are included in the list? And that there are no duplicates which could possibly alter the tr's behaviour? His answer should be replaced by mine since you asked :)
Apr 27, 2017 at 22:43 review Late answers
Apr 27, 2017 at 22:58
Apr 27, 2017 at 22:40 comment added Fox In what way is this different from the existing answers? Specifically, herbert's comes to mind.
Apr 27, 2017 at 22:27 review First posts
Apr 27, 2017 at 22:42
Apr 27, 2017 at 22:24 history answered drws CC BY-SA 3.0