Thread: Password salts
View Single Post
Old 06-25-2008, 10:53 PM   #4 (permalink)
h0ly lag
The Contributor
 
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
h0ly lag is on a distinguished road
Default

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($possiblemt_rand(0strlen($possible) - 1), 1);
        
$salt .= $char;
        
$i++;
        }

    return 
$salt;
    } 
__________________
Send a message via AIM to h0ly lag Send a message via MSN to h0ly lag
h0ly lag is offline  
Reply With Quote