标题:求高手帮忙,帮我反写个程序,谢谢
取消只看楼主
as4491
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-2-9
 问题点数:0 回复次数:0 
求高手帮忙,帮我反写个程序,谢谢
<?
function sample($s)
{
$hexchars = '0123456789ABCDEF';
if ( !$s || strlen($s) <= 0 )
{
echo "null string.";
return "";
}
$len = strlen($s);
$ret = '';
$curc = 0;
    $nextc = ord(substr($s, 0, 1));
for ($i=1; $i<$len; $i++ )
{
$curc = $nextc;
$nextc = ord(substr($s, $i, 1));
$curc ^= $nextc;
//echo '<br> 0x'. substr($hexchars, ($curc & 0xF0) >> 4, 1) . substr($hexchars, $curc & 0x0F, 1);
$ret .= substr($hexchars, ($curc & 0xF0) >> 4, 1);
$ret .= substr($hexchars, $curc & 0x0F, 1);
}
$curc = $nextc ^ 0x7C;
$ret .= substr($hexchars, ($curc & 0xF0) >> 4, 1);
echo $ret;
echo "<br>";
$ret .= substr($hexchars, $curc & 0x0F, 1);
return $ret;
}
$a="srvaddr=127.0.0.1";
$b=sample($a);
echo $b;
function sample2($s)
{
    //现在就想写个程序,把这个$b给还原成$a,请高手帮忙写个
}
$c=sample2($b);
echo $c;


?>
搜索更多相关主题的帖子: function return null 
2015-02-09 19:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-441922-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018482 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved