Skip to content

Instantly share code, notes, and snippets.

@vibby
Created December 20, 2016 16:25
Show Gist options
  • Save vibby/5647b1f5067842c147fb2b19657a7a3e to your computer and use it in GitHub Desktop.
Save vibby/5647b1f5067842c147fb2b19657a7a3e to your computer and use it in GitHub Desktop.
<?php
$minlength = 6; // Must be a multiple of 2 !! So 14 will work, 15 won't, 16 will, 17 won't and so on
$maxlength = 10;
$nb = 100;
function addChar(array $list) {
$add = $list[rand(0, count($list)-1)];
if (rand(0,1)) {
$add = strtoupper($add);
}
return $add;
}
// Password generation
$conso=array("b","c","d","f","g","h","j","k","l", "m","n","p","r","s","t","v","w","x","z","ch","br","cr","cl","dr","fr","fl","gr","gl","kr","kl","pr","pl","sl","tr","vr");
$vocal=array("a","e","i","o","u", "y", "ou", "eu", "au", "ai", "ei", "oe", "ui", "3", "4", "1");
srand ((double)microtime()*1000000);
$max = floor($minlength/2);
for($c=1; $c<=$nb; $c++)
{
$password="";
for($i=1; $i<=$minlength; $i++)
{
$password .= addChar($conso);
$password .= addChar($vocal);
}
$password = substr($password, 0, rand($minlength, $maxlength));
echo $password."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment