【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了encrypt40.php提供大家参考,希望对大家有所帮助!
<?php
function AscType($strGetWords){
$ResultAscType='';
$BytLen='';
$LenGetWords=strlen($strGetWords);
for($point=0;$point<$LenGetWords;$point++){
$strTmp=Dec2Bin(ord(substr($strGetWords,$point,1)));
$ResultAscType=$strTmp.$ResultAscType;
$BytLen=$BytLen.Dec2Bin(strlen($strTmp));
}
$ResultAscType=$ResultAscType.Dec2Bin($LenGetWords).$BytLen;
return SignWrite($ResultAscType);
}
function Dec2Bin($n_DecNum){
$sBinNum='';
$nDecNum=(abs($n_DecNum));
while($nDecNum>0){
$sBinNum=((string)($nDecNum%3)).$sBinNum;
$nDecNum=(int)($nDecNum/3);
}
return $sBinNum;
}
function SignWrite($s_Num){
$sNum=settype($s_Num,"string");
$sNum=str_replace(chr(48),chr(42),$sNum);
$sNum=str_replace(chr(49),chr(35),$sNum);
$sNum=str_replace(chr(50),chr(36),$sNum);
return $sNum;
}
?>