Skip to content

Instantly share code, notes, and snippets.

@alexedwards
Created June 19, 2010 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexedwards/445157 to your computer and use it in GitHub Desktop.
Save alexedwards/445157 to your computer and use it in GitHub Desktop.
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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