I would like to generate a random password of a defined length which can easily be typed in with a standard keyboard.

As a start I tried the following:

SeedRandom["pass"];
StringJoin[RandomChoice[CharacterRange[33, 126], 10]
(* "=IP@7mbYcB" *)


Do you know other solutions?

• "欲穷千里目，更上一层楼。"means “Yqqlm_Gs1cl”.I'm sure anyone cannot broke it.And it is easy to remember. :) – yode Jul 20 '17 at 3:56

A shorter formulation equivalent to your own code is:

FromCharacterCode @ RandomInteger[{33, 126}, 10]

"+(pCT4W#;T"


However quite a few places only accept alphanumeric passwords, and not all keyboards have the same easily accessible character sets. If we assume that your given example is sufficiently secure you need 94^10 ~= 5*10^19 unique passwords. This is easily accomplished by adding a single alphanumeric character as 62^11 ~= 5*10^19. Therefore I propose:

rnd =
FromCharacterCode @
RandomChoice[Join @@ Range[{48, 97, 65}, {57, 122, 90}], #] &;

rnd[11]

"liLC2RoA3cR"


rnd[{5, 11}]

{"suPwm0c7FxS", "CV3khXaowWS", "Lac9z1IVCwc", "gptfkp2GMwH", "HDhRuFPLxte"}

• Could you remember anyone? :) – yode Jul 20 '17 at 14:54
• @yode One? Yes. A significant number? No. My strategy is to use a password manager that effectively locks away a list of passwords behind a single one. There is no way I could remember a large number of high quality passwords no matter the scheme used. – Mr.Wizard Jul 20 '17 at 21:59

Here's something which is nice and might be easy to remember:

StringJoin @@ RandomSample[#, Length@#] &@
Flatten@{IntegerString@RandomInteger[{10, 999}],
Capitalize /@ RandomWord[3],
RandomSample[Characters@"!@_%\$^=+*.", 2]
}


Select examples:

"Tearless+PostdoctoralDragon=635" (*DEFINTIELY MY FAVORITE!!*)
"Workpiece.Monopolize908Moderate="
"Venereal854RebelliouslyProportionality%."


## EDIT

To increase the entropy, you may want to make spelling mistakes. Here's a great way to produce pronounceable non-words:

spoilWord[word_String] :=
Transliterate@
Transliterate[word,
RandomChoice@{"Hebrew", "Arabic", "Japanese", "Korean","Greek"}
]


Example:

spoilWord@RandomWord[]
(*"matelialismeu"*)

• This is a really funny solution ... I like it very much. – mrz Jul 20 '17 at 3:53
• To increase entropy, you can also just add one or two more all lowercase, space-separated words. "a thought that never changes remains a stupid lie" is a very secure password that's both easy to remember and type. (Okay, depends, if someone knows I'm using verses from lyrics of songs I can randomly recall that will probably reduce the search space significantly compared to "ten random words.") – millimoose Jul 20 '17 at 10:00
• I would personally get rid of the extra punctuation - it's more to remember for very little entropy gain. – corsiKa Jul 20 '17 at 19:06