Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
325 richard 1
<?php
2
function da_encrypt()
3
{
4
	$numargs=func_num_args();
5
	$passwd=func_get_arg(0);
1467 richard 6
	# set the salt and the algorithm
7
	$shuf = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"),0,8);
1464 richard 8
	# hash md5 > empreinte du mot de passe sur 22 caracteres
1467 richard 9
	//$salt='$1'.'$'.$shuf.'$';
1464 richard 10
	# hash sha-256 > empreinte du mot de passe sur 43 caracteres
1467 richard 11
	$salt='$5'.'$'.$shuf.'$';
1464 richard 12
	# hash sha-512 > empreinte du mot de passe sur 86 caracteres
1467 richard 13
	#$salt='$6'.'$'.$shuf.'$';
14
	if ($numargs == 2){ //only to test and change password (keep the old algorythm and salt)
325 richard 15
		$salt=func_get_arg(1);
16
		return crypt($passwd,$salt);
17
	}
18
        return crypt($passwd,$salt);
19
}
20
?>