Skip to content

Instantly share code, notes, and snippets.

@Demeter
Forked from alexedwards/gist:445157
Created October 14, 2011 18:49
Show Gist options
  • Save Demeter/1287954 to your computer and use it in GitHub Desktop.
Save Demeter/1287954 to your computer and use it in GitHub Desktop.
another password phraser
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple Password - Returns a simple pronouncable passphrase.
Examples: Motir27, Wesag97, Muvak41
Rated as 'good' by http://www.passwordmeter.com/
@access public
@return string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function simple_password() {
$vowels = array ("a","e","i","o","u");
$consonants = array ("b","c","d","f","g","h","k","l","m","n","p","r","s","t","v","w","z");
$CI =& get_instance();
$CI->load->helper("array");
return strtoupper(random_element($consonants)) . random_element($vowels) . random_element($consonants) . random_element($vowels) . random_element($consonants) . (string) rand(10,99);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Strong Password - Returns a strong passphrase.
Examples: Kusid+109, Nitig-580, Gigom!899
Rated as 'very strong' by http://www.passwordmeter.com/
@access public
@return string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function strong_password() {
$symbols = array ("!","$","@","#","?","=",":","+","-","_");
$vowels = array ("a","e","i","o","u");
$consonants = array ("b","c","d","f","g","h","k","l","m","n","p","r","s","t","v","w","z");
$CI =& get_instance();
$CI->load->helper("array");
return strtoupper(random_element($consonants))
. random_element($vowels)
. random_element($consonants)
. random_element($vowels)
. random_element($consonants)
. random_element($symbols)
. (string) rand(100,999);
}
/* End of file password_helper.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment