JS 代码转 PHP 多谢
程序员文章站
2022-05-22 20:28:22
...
JS 代码转 PHP 谢谢
这是是JS的, 我想转成PHP的,
不懂PHP,谢谢呀
function Getkey(key, sc) {
return (key * 0x0063 + sc) % 0x100
}
function Apple(str) {
var len = str.length / 2;
var i = 1;
var tmp = '';
var key = eval("0x" + str.charAt(0) + str.charAt(1));
while (i istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
if (istr == 2) {
i = i + 1;
key = Getkey(key, istr);
istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
jstr = istr;
i = i + 1;
key = Getkey(key, istr);
istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
jstr = jstr * 256 + istr;
tmp = tmp + String.fromCharCode(jstr)
} else tmp = tmp + String.fromCharCode(istr);
i = i + 1;
key = Getkey(key, istr)
}
return tmp
}
------解决方案--------------------
这是是JS的, 我想转成PHP的,
不懂PHP,谢谢呀
function Getkey(key, sc) {
return (key * 0x0063 + sc) % 0x100
}
function Apple(str) {
var len = str.length / 2;
var i = 1;
var tmp = '';
var key = eval("0x" + str.charAt(0) + str.charAt(1));
while (i istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
if (istr == 2) {
i = i + 1;
key = Getkey(key, istr);
istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
jstr = istr;
i = i + 1;
key = Getkey(key, istr);
istr = eval("0x" + str.charAt(i * 2) + str.charAt(i * 2 + 1));
istr = key ^ istr;
jstr = jstr * 256 + istr;
tmp = tmp + String.fromCharCode(jstr)
} else tmp = tmp + String.fromCharCode(istr);
i = i + 1;
key = Getkey(key, istr)
}
return tmp
}
------解决方案--------------------
- PHP code
echo Apple("123123");//输出 "#:" 对吗?function Getkey($key, $sc){ return ($key * 0x0063 + $sc) % 0x100;}function Apple($str) { $len = mb_strlen($str, "GBK") / 2; $i = 1; $tmp = ''; $key = "0x" . $str{0} . $str{1} + 0; while ($i ------解决方案--------------------
楼上厉害!
------解决方案--------------------
相关文章
相关视频
上一篇: html meter标签的使用与作用详解
下一篇: 2011中国PHP技术高峰论坛精彩看点