Subversion Repositories ALCASAR

Rev

Rev 1464 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log

<?php
function da_encrypt()
{
        $numargs=func_num_args();
        $passwd=func_get_arg(0);
        # set the salt and the algorithm
        $shuf = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"),0,8);
        # hash md5 > empreinte du mot de passe sur 22 caracteres
        //$salt='$1'.'$'.$shuf.'$';
        # hash sha-256 > empreinte du mot de passe sur 43 caracteres
        $salt='$5'.'$'.$shuf.'$';
        # hash sha-512 > empreinte du mot de passe sur 86 caracteres
        #$salt='$6'.'$'.$shuf.'$';
        if ($numargs == 2){ //only to test and change password (keep the old algorythm and salt)
                $salt=func_get_arg(1);
                return crypt($passwd,$salt);
        }
        return crypt($passwd,$salt);
}
?>