<p>I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is</p>

<p>il10o8B3Evu![]{}</p>

<p>Are there any other pairs of characters that are easy to confuse? for special characters I was going to limit myself to those under the number keys, though I know that this differs depending on your keyboards nationality!</p>

<p>As a rider question, I would like my passwords to be 'wordlike'do you have a favoured algorithm for that?</p>

<p>Thanks :)</p>

[{'answer_id': 55568, 'author': 'Jim McKeeth', 'author_id': 255, 'author_profile': 'https://Stackoverflow.com/users/255', 'pm_score': 3, 'selected': False, 'text': "<p>My preferred method is to get a word list of 3, 4 and 5 letter words.  Then select at least 2 of those, and place a random 2 digit number or special symbol (%&amp;*@#$) between each word.  If you want to you can capitalize up to one character per word at random.</p>\n\n<p>Depending on your strength requirements you end up with easy-to-remember and communicate passwords like:</p>\n\n<ul>\n<li>lemon%desk</li>\n<li>paper&amp;boy32hat</li>\n</ul>\n\n<p>Keep in mind you occasionally get interesting or inappropriate combinations of words (I'll let you use your imagination).  I usually have a button allowing the generation of a new password if the one presented is disliked. </p>\n\n<p>As a rule, only use symbols that people commonly know the name for.  On a US Standard keyboard I would avoid ~`'/\\^</p>\n\n<p>I guess this more answered your rider question than your main question . .. </p>\n\n<p>Good luck!</p>\n"}, {'answer_id': 55619, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>To add to Jim's answer you could also use the word list and randomly replace certain characters with symbols (an @ for an A, a 0 (zero) for an O or a 5 for an S) and/or remove the vowels from the words.</p>\n\n<ul>\n<li>lmn%Desk</li>\n<li>p@per&amp;b0y32H@t</li>\n</ul>\n\n<p>Still mostly human readable.</p>\n"}, {'answer_id': 55634, 'author': 'dF.', 'author_id': 3002, 'author_profile': 'https://Stackoverflow.com/users/3002', 'pm_score': 7, 'selected': True, 'text': '<p>Here are the character sets that Steve Gibson uses for his <a href="https://www.grc.com/ppp.htm" rel="noreferrer">"Perfect Paper Password"</a> system. They are "characters to allow" rather than "characters to avoid", but they seem pretty reasonable for what you want:</p>\n\n<p>A standard set of 64 characters</p>\n\n<pre><code>!#%+23456789:=?@ABCDEFGHJKLMNPRS\nTUVWXYZabcdefghijkmnopqrstuvwxyz\n</code></pre>\n\n<p>A larger set of 88 characters</p>\n\n<pre><code>!"#$%&amp;\'()*+,-./23456789:;&lt;=&gt;?@ABCDEFGHJKLMNO\nPRSTUVWXYZ[\\]^_abcdefghijkmnopqrstuvwxyz{|}~\n</code></pre>\n\n<p>For pronounceable passwords, I\'m not familiar with the algorithms but you might want to look at <a href="http://www.adel.nursat.kz/apg/" rel="noreferrer">APG</a> and <a href="http://sourceforge.net/projects/pwgen/" rel="noreferrer">pwgen</a> as a starting point.</p>\n'}, {'answer_id': 55689, 'author': 'Dana the Sane', 'author_id': 2567, 'author_profile': 'https://Stackoverflow.com/users/2567', 'pm_score': 2, 'selected': False, 'text': '<p>As another option, you could use a monospace/terminal font like courier for printing the passwords. Similar characters should be a lot more distinguishable that way.</p>\n'}, {'answer_id': 55798, 'author': 'erickson', 'author_id': 3474, 'author_profile': 'https://Stackoverflow.com/users/3474', 'pm_score': 3, 'selected': False, 'text': '<p>Read <a href="http://www.schneier.com/blog/archives/2007/01/choosing_secure.html" rel="noreferrer">Choosing Secure Passwords</a>. </p>\n\n<p>One interesting tidbit from there: For more secure passwords, make sure some numbers and special characters appear in the middle. Cracking programs check for them at the beginning and ends sooner.</p>\n'}, {'answer_id': 57417, 'author': 'tqbf', 'author_id': 5674, 'author_profile': 'https://Stackoverflow.com/users/5674', 'pm_score': 1, 'selected': False, 'text': "<p>I don't love the wordlist approach. For example, in /usr/share/dict/words on OSX, there are 5110 4-character words. Using two of them with a seperator character produces ~600M combinations. But if you used the character set directly with a strong random number generator, you'd have 88^9 possible passwords, 3.16e+17 combinations. </p>\n\n<p>Either way, the likely attack against this system is going to be against the random number generator, so make sure you're using a cryptographically strong one. If you use PHP's standard rand function, it will be attacked by registering and resetting thousands of passwords to sample the RNG state and then predict the remaining RNG state, which will reduce the number of possible passwords an attacker needs to test. </p>\n"}, {'answer_id': 57452, 'author': 'James B', 'author_id': 2951, 'author_profile': 'https://Stackoverflow.com/users/2951', 'pm_score': 2, 'selected': False, 'text': "<p>For human-readable passwords, I recently used a PHP script very similar to the one below.  It worked well.  Granted, the passwords aren't going to be incredibly secure (as they're prone to dictionary attacks), but for memorisable, or at least readable, passwords it works well.  However, this function shouldn't be used as-is, it's more for illustration than anything else.</p>\n\n<pre><code>function generatePassword($syllables = 2, $use_prefix = true)\n{\n\n    // Define function unless it is already exists\n    if (!function_exists('arr'))\n    {\n        // This function returns random array element\n        function arr(&amp;$arr)\n        {\n            return $arr[rand(0, sizeof($arr)-1)];\n        }\n    }\n\n    // Random prefixes\n    $prefix = array('aero', 'anti', 'auto', 'bi', 'bio',\n                    'cine', 'deca', 'demo', 'dyna', 'eco',\n                    'ergo', 'geo', 'gyno', 'hypo', 'kilo',\n                    'mega', 'tera', 'mini', 'nano', 'duo',\n                    'an', 'arch', 'auto', 'be', 'co',\n                    'counter', 'de', 'dis', 'ex', 'fore',\n                    'in', 'infra', 'inter', 'mal', \n                    'mis', 'neo', 'non', 'out', 'pan',\n                    'post', 'pre', 'pseudo', 'semi',\n                    'super', 'trans', 'twi', 'vice');\n\n    // Random suffixes\n    $suffix = array('dom', 'ity', 'ment', 'sion', 'ness',\n                    'ence', 'er', 'ist', 'tion', 'or',\n                    'ance', 'ive', 'en', 'ic', 'al',\n                    'able', 'y', 'ous', 'ful', 'less',\n                    'ise', 'ize', 'ate', 'ify', 'fy', 'ly'); \n\n    // Vowel sounds \n    $vowels = array('a', 'o', 'e', 'i', 'y', 'u', 'ou', 'oo', 'ae', 'ea', 'ie'); \n\n    // Consonants \n    $consonants = array('w', 'r', 't', 'p', 's', 'd', 'f', 'g', 'h', 'j', \n                        'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'qu');\n\n    $password = $use_prefix?arr($prefix):'';\n    $password_suffix = arr($suffix);\n\n    for($i=0; $i&lt;$syllables; $i++)\n    {\n        // selecting random consonant\n        $doubles = array('n', 'm', 't', 's');\n        $c = arr($consonants);\n        if (in_array($c, $doubles)&amp;&amp;($i!=0)) { // maybe double it\n            if (rand(0, 2) == 1) // 33% probability\n                $c .= $c;\n        }\n        $password .= $c;\n        //\n\n        // selecting random vowel\n        $password .= arr($vowels);\n\n        if ($i == $syllables - 1) // if suffix begin with vovel\n            if (in_array($password_suffix[0], $vowels)) // add one more consonant \n                $password .= arr($consonants);\n\n    }\n\n    // selecting random suffix\n    $password .= $password_suffix;\n\n    return $password;\n}\n</code></pre>\n"}, {'answer_id': 64836, 'author': 'flamingLogos', 'author_id': 8161, 'author_profile': 'https://Stackoverflow.com/users/8161', 'pm_score': 2, 'selected': False, 'text': '<p>For an international client several years ago, I had to generate random, secure passwords that were then mail-merged into documents by my client and sent by postal mail to recipients in 40 countries. Not knowing what typeface was to be used in the documents, I used a list of characters like the Steve Gibson <a href="https://www.grc.com/ppp.htm" rel="nofollow noreferrer">64-character</a> set to eliminate the confusion between similar glyphs.</p>\n\n<p>To make the resulting passwords pronounceable, and thus easier to remember, I paired consonants and vowels together, with some consonant digraphs (sh, th, wh, etc.) added to the mix. </p>\n\n<p>To reduce the chances of inappropriate or offensive words from being generated (in English or in the recipients’ languages), I limited runs of consecutive alpha characters to two, with numerals or punctuation characters betwee:</p>\n\n<pre><code>Es4tU$sA6\nwH@cY8Go2\n</code></pre>\n\n<p>Looking back over my method now, I realize that there was room for improvement in the inappropriateness algorithm. Using the just the rules above, some offensive words are possible now that some numerals and punctuation are substituted for letters.</p>\n'}, {'answer_id': 201599, 'author': 'Paul Nathan', 'author_id': 26227, 'author_profile': 'https://Stackoverflow.com/users/26227', 'pm_score': 1, 'selected': False, 'text': "<p>A starting approach might be to generate mostly valid english syllables, mix them, then throw in a text->l33t conversion. There's been work done on generational natural language grammars, so one of those might help.</p>\n\n<p>E.g. ah ul ing are all valid syllables or close to it... mix them -> Ingulah...l33t it -> 1ngu4h. Is it the best out there? Nah. But at least it is semipronouncable(if you speak l33t) and more computationally secure.</p>\n"}, {'answer_id': 242285, 'author': 'Adam Liss', 'author_id': 29157, 'author_profile': 'https://Stackoverflow.com/users/29157', 'pm_score': 2, 'selected': False, 'text': '<p>In my (electrical engineering, techie) graduate school, all computer accounts were initialized with passwords that, I assume, were generated by a standard linux utility.  They consisted of three random syllables, with three lowercase letters in each syllable.  The result was reasonably secure (on the order of billions of possible combinations) yet so pronounce-able that I still use some of those passwords over a decade later.  James\' example is an excellent demonstration of this.</p>\n\n<p>A comment on passwords in general, from a network-security professional:  they\'re terrible, for several reasons, including:</p>\n\n<ul>\n<li><p>Generally easily broken, either through social engineering or with attack software, especially if you know <em>anything</em> about your target.   </p>\n\n<p><em>Example 1:</em>  I recently needed to revise a password-protected technical document.  Looking at the date, I knew who our Tech Writer in residence was at the time, typed the first word that entered my mind, and immediately unlocked the document.  </p>\n\n<p><em>Example 2:</em>  Standard password-cracking programs allow the cracker to specify a set of rules that operate on a user-supplied dictionary.  It\'s trivial to replace certain letters with $ymb01$, or to translate into 1337, etc.</p></li>\n<li><p>"Secure" passwords aren\'t.  Given the sheer number of passwords most people need to remember, the most common way to "remember" a "strong" password like "a4$N!8_q" is to write it on a piece of paper (or, worse, store it in a text file).  \'Nuff said.</p></li>\n</ul>\n\n<p>If you need truly <em>secure</em> authentication, <em>multi-factor</em> (or <em>two-factor</em>) is the industry-accepted mechanism.  The "two factors" are usually something you <em>have</em> (such as an access card) and something you <em>know</em> that enables it (such as a PIN).  Neither one works without the other--you need both.</p>\n\n<p>On the other hand, consider the level of security you really need.  What are you protecting?  How badly do the "bad guys" want to get it, and what are the consequences if they do?  Chances are, "Its@Secret!" is more than good enough.  :-)</p>\n'}, {'answer_id': 9651123, 'author': 'Anonym', 'author_id': 1261653, 'author_profile': 'https://Stackoverflow.com/users/1261653', 'pm_score': 1, 'selected': False, 'text': '<pre><code>function random_readable_pwd($length=12){\n    // special characters\n    $sym="!\\"§$%&amp;/()={[]}\\,.-_:;@&gt;|";\n\n    // read words from text file to array\n    $filename="special.txt";\n    if (!file_exists($filename)) { die(\'File "\'.$filename.\'" is not exists!\'); }\n    $lines = file($filename);\n    foreach ($lines as $line_num =&gt; $line) {\n        $line=substr($line, 0, -2);\n        $words[].=$line;\n    }\n\n    // Add words while password is smaller than the given length\n    $pwd = \'\';\n    $ran_date=date("s");\n    while (strlen($pwd) &lt; $length){\n        $r = mt_rand(0, count($words)-1);\n        // randomly upercare word but not all in one time\n        if ($ran_date % 3 == 0) $words[$r]=ucwords($words[$r]);\n        $pwd .= $words[$r];\n        //randomly add symbol\n        if ($ran_date % 2 == 0) $pwd .= $sym{mt_rand(0,strlen($sym))};\n        $ran_date++;\n    }\n\n    // append a number at the end if length &gt; 2 and\n    // reduce the password size to $length\n    $num = mt_rand(1, 99);\n    if ($length &gt; 2){\n        $pwd = substr($pwd,0,$length-strlen($num)).$num;\n    } else { \n        $pwd = substr($pwd, 0, $length);\n    }\n\n    return $pwd;\n\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/55556', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5552/']