How to generates a password salt (default = 15) characters
<?php
/**
* This function generates a password salt as a string of x (default = 15) characters
* ranging from a-zA-Z0-9.
* @param $max integer The number of characters in the string
* @author AfroSoft <scripts@afrosoft.co.cc>
*/
function generateSalt($max = 15) {
$characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$i = 0;
$salt = "";
do {
$salt .= $characterList{mt_rand(0,strlen($characterList))};
$i++;
} while ($i <= $max);
return $salt;
}
?>
/** end of http://code.activestate.com/recipes/576894/ }}} */

Processing your request, Please wait....
No Responses to “How to generates a password salt (default = 15) characters”
Comments (Your Comments)
Leave a Reply