PHP暗号解読関数のセットの共有

1440 ワード

 
  
/**
* :
* :
* :
*/
function passport_encrypt($str,$key){ //
srand((double)microtime() * 1000000);
$encrypt_key=md5(rand(0, 32000));
$ctr=0;
$tmp='';
for($i=0;$i$ctr=$ctr==strlen($encrypt_key)?0:$ctr;
$tmp.=$encrypt_key[$ctr].($str[$i] ^ $encrypt_key[$ctr++]);
}
return base64_encode(passport_key($tmp,$key));
}

/**
* :
* :
* :
*/
function passport_decrypt($str,$key){ //
$str=passport_key(base64_decode($str),$key);
$tmp='';
for($i=0;$i$md5=$str[$i];
$tmp.=$str[++$i] ^ $md5;
}
return $tmp;
}

/**
*
*/
function passport_key($str,$encrypt_key){
$encrypt_key=md5($encrypt_key);
$ctr=0;
$tmp='';
for($i=0;$i$ctr=$ctr==strlen($encrypt_key)?0:$ctr;
$tmp.=$str[$i] ^ $encrypt_key[$ctr++];
}
return $tmp;
}
$str=' :WWW.JB51.NET;
$key='jb51net';
$encrypt=passport_encrypt($str,$key);
$decrypt=passport_decrypt($encrypt,$key);

echo ' :',$str."


";
echo ' :',$encrypt."

";
echo ' :',$decrypt."

";
?>