那边的加密是用php的crypt加密,我用了java中的Md5Crypt.md5Crypt去进行加密,但是加密后的值不一样,然后他给了我加密源码,我能理解到时一个循环,但是不太理解意思,因为没有接触过php,所以希望有大神帮我解释下下面这段代码,谢谢。
function getPass($str,$seed=NULL){
if ($seed){
$result = crypt($str,'$1$'.$seed.'$');
} else {
$seed = '';
$i = 0;
while ($i<8){
$a = rand(65,122);
if (($a>64 && $a<91) || ($a>96 && $a<123)){
$seed = $seed.chr($a);
$i++;
}
}
$result = crypt($str,'$1$'.$seed.'$');
}
return $result;