Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save waldyrious/86cc5a8b947e75d941383f481ace7601 to your computer and use it in GitHub Desktop.
Save waldyrious/86cc5a8b947e75d941383f481ace7601 to your computer and use it in GitHub Desktop.
Human Readable Password Generator
<?php
function randomPassword($len = 8){
/* Programmed by Christian Haensel
** christian@chftp.com
** http://www.chftp.com
**
** Exclusively published on weberdev.com.
** If you like my scripts, please let me know or link to me.
** You may copy, redistribute, change and alter my scripts as
** long as this information remains intact.
**
** Modified by Josh Hartman on 12/30/2010.
*/
if(($len%2)!==0){ // Length paramenter must be a multiple of 2
$len=8;
}
$length=$len-2; // Makes room for the two-digit number on the end
$conso=array('b','c','d','f','g','h','j','k','l','m','n','p','r','s','t','v','w','x','y','z');
$vocal=array('a','e','i','o','u');
$password='';
srand ((double)microtime()*1000000);
$max = $length/2;
for($i=1; $i<=$max; $i++){
$password.=$conso[rand(0,19)];
$password.=$vocal[rand(0,4)];
}
$password.=rand(10,99);
$newpass = $password;
return $newpass;
}
echo randomPassword();
?>
@chrishaensel
Copy link

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment