Current time: 11-17-2024, 05:44 AM Hello There, Guest! (LoginRegister)


Post Reply 
ending numbers ignored on ftp password
Author Message
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #7
RE: ending numbers ignored on ftp password
I`d like to propose a better solution for function generate_rand_salt
Code:
function generate_rand_salt($min = 46, $max = 126) {
    if (CRYPT_BLOWFISH == 1) {
        $length=13;
        $pre='$2$';
    } elseif (CRYPT_MD5 == 1) {
        $length=9;
        $pre='$1$';
    } elseif (CRYPT_EXT_DES == 1) {
        $length=9;
        $pre='';
    } elseif (CRYPT_STD_DES == 1) {
        $length=2;
        $pre='';
    }
    $salt=$pre;
    for($i=0;$i<$length;$i++)
        $salt .= chr(mt_rand($min, $max));
    return $salt;
}
Also restore function to crypt_user_ftp_pass
Code:
function crypt_user_ftp_pass($data) {
    $res = crypt($data, generate_rand_salt());
    return $res;
}


Attached File(s)
.txt  patch.txt (Size: 1.01 KB / Downloads: 1)
(This post was last modified: 07-02-2008 06:12 AM by sci2tech.)
07-02-2008 06:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: ending numbers ignored on ftp password - sci2tech - 07-02-2008 06:06 AM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)