Skip to content

Instantly share code, notes, and snippets.

@fridolin-koch
Created November 23, 2012 14:15
Show Gist options
  • Save fridolin-koch/4135817 to your computer and use it in GitHub Desktop.
Save fridolin-koch/4135817 to your computer and use it in GitHub Desktop.
Random password and salt
$salt = '';
$password = '';
for($i=0;$i < 64;$i++) {
$char = '';
switch(rand(0,3)) {
//A-Z
case 0:
$char = chr(rand(65,90));
break;
//a-z
case 1:
$char = chr(rand(97,122));
break;
//0-9
case 2:
$char = chr(rand(97,122));
break;
}
$salt .= $char;
if(strlen($password) < 8)
$password .= $char;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment