Random Password Generator (based on word list)
This is a random password generator that creates understandable passwords supported word lists. I have just
enclosed a three entry world list since you had better selected a list based on your password requisites and your
users. Whenever you want to get passwords that are fourteen characters long, you’ll require different list than
if you are getting in eight character passwords. And dependant on your users, you may prefer to apply certain
lists. The list I use is almost 4000 words that are 5-7 characters long, all known words that have accepted
potentially offensive content removed. For security grounds I do not want to let in this list.
A mention on security: although this returns relatively solid passwords for the ordinary user, they’re particularly
subject to brute-force attempts. This is even more a matter if someway your word list finds compromised. I’d
not recommend applying this function for anything where an extremely secure password is required.
A mention on selecting your list: you will as well see that I have improved the system to avoid returning
passwords with zeros and ones in them. This is because zero and capital “o” can be mixed-up equally can one,
lowercase “L” and uppercase “i.” When selecting my word list I was as well certain to clean away all words that
begin on the letter “i” or “o” (to keep the optional ucfirst() from making 0 / O and 1 / I mix-up) and words that
carry the letter “L” (to keep l/1 mix-up). I feel that this greatly helps on preventing mix-up, but once more
breaks the protection of the passwords a few. It is your option.
function generatePassword($maxLen = 8)
$words = array(‘alaska’, ‘aline’, ‘alone’,); // Use your personal list here!!!
while (strlen($word) > $maxLen || !$word) $word = $words[array_rand($words, 1)];
if (rand(0,1)) $word = ucfirst($word);
for ($i = 0; $i < $maxLen – strlen($word); $i++) rand(0,1) ? $opener .= rand(2,9) : $closer .=
for ($i = 0; $i < 20; $i++)
echo generatePassword() . ” “;
Produces: 6Aline43 79Aline7 aline4 2Aline85 58alaska5 59Aline3 4aline Aline3 6alaska44 3Alone Aline587 Aline994
8Aline56 Aline259 699aline 4Aline88 alone3 alone3 Alaska322 267Alaska
Leave a Reply
You must be logged in to post a comment.