06-25-2008, 10:53 PM
|
#4 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
|
Thanks Wildhoney, I read both of the articles and all the replies. It seems like I was already on the right track.
Anyways, here is something I pieced together with some help from Google. It will generate my random salt. Not sure why I'm posting it, figure it might help someone. Or maybe some critique?
PHP Code:
//generates a random salt for use when crypting user passwords //includes all upper and lower case, numbers, and common symbols (no ALT code symbols) function gen_salt($length) { $salt = ""; $possible = "abcdefghjklmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-+=[]{}\/.,?<>`~"; $i = 0;
while($i < $length) { $char = substr($possible, mt_rand(0, strlen($possible) - 1), 1); $salt .= $char; $i++; }
return $salt; }
__________________
|
|
|