标题: 求将这段js代码转成php
时间: 2023-01-18发布,2023-01-18修改
var obj = "A4NjFqYu5wPHsO0XTdDgMa2r1ZQocVte9UJBvk6/7=yRnhISGKblCWi+LpfE8xzm3";
var strs = '0c4a20131ebd12f0de2b54163fe318b1e'
var r = "";
for (let i = 0;i < strs.length;) {
var ccc = '0c4a2013ebd12f0de2b54163fe318b1e'.charCodeAt(i++);
var iii = (ccc) >> 2;
var e = '0c4a2013ebd12f0de2b54163fe318b1e'.charCodeAt(i++);
var aaa =((3 & ccc) << 4) | (e >> 4);
var n = '0c4a2013ebd12f0de2b54163fe318b1e'.charCodeAt(i++);
var bbb =((15 & e) << 2) | (n >> 6);
var ccc = 63 & n;
isNaN(e)? (bbb = ccc = 64): isNaN(n) && (ccc = 64);
var r = r + obj.charAt(iii) + obj.charAt(aaa) + obj.charAt(bbb) + obj.charAt(ccc);
}
console.log(r)
『回复列表(21|隐藏机器人聊天)』
ChatGPT:
<?php
$obj = "A4NjFqYu5wPHsO0XTdDgMa2r1ZQocVte9UJBvk6/7=yRnhISGKblCWi+LpfE8xzm3";
$strs = '0c4a20131ebd12f0de2b54163fe318b1e';
$r = "";
for ($i = 0; $i < strlen($strs);) {
$ccc = ord($strs[$i++]);
$iii = ($ccc) >> 2;
$e = ord($strs[$i++]);
$aaa = ((3 & $ccc) << 4) | ($e >> 4);
$n = ord($strs[$i++]);
$bbb = ((15 & $e) << 2) | ($n >> 6);
$ccc = 63 & $n;
is_nan($e) ? $bbb = $ccc = 64 : is_nan($n) && ($ccc = 64);
$r = $r . $obj[$iii] . $obj[$aaa] . $obj[$bbb] . $obj[$ccc];
}
echo $r;
?>
结果依然是sYsC1g5GsgOk16TKs61GZYMb1BMCsg1lZ6MlsgUJs2M3
<?php
$obj = "A4NjFqYu5wPHsO0XTdDgMa2r1ZQocVte9UJBvk6/7=yRnhISGKblCWi+LpfE8xzm3";
$strs = '0c4a20131ebd12f0de2b54163fe318b1e';
$strs2 = '0c4a2013ebd12f0de2b54163fe318b1e';
$r = "";
for ($i = 0; $i < strlen($strs);) {
$ccc = $i < strlen($strs2) ? ord($strs2[$i]) : NAN; $i++;
$iii = ($ccc) >> 2;
$e = $i < strlen($strs2) ? ord($strs2[$i]) : NAN; $i++;
$aaa = ((3 & $ccc) << 4) | ($e >> 4);
$n = $i < strlen($strs2) ? ord($strs2[$i]) : NAN; $i++;
$bbb = ((15 & $e) << 2) | ($n >> 6);
$ccc = 63 & $n;
is_nan($e) ? $bbb = $ccc = 64 : is_nan($n) && ($ccc = 64);
$r = $r . $obj[$iii] . $obj[$aaa] . $obj[$bbb] . $obj[$ccc];
}
echo $r;