We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无意间发现。。20871和20872只要是这2个视频ID的进行加密。 不管是修改加密长度还是修改密匙 计算出来的加密ID竟然不一样。还不知道这种线下有多少。 如果这种情况很多。。 那直接炸裂。。。
echo mac_alphaID(20872,false,11,'abcdefggg'); function mac_alphaID($in, $to_num=false, $pad_up=false, $passKey='') { $key = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (!empty($passKey)) { for ($n = 0; $n<strlen($key); $n++) { $i[] = substr($key,$n ,1); } $len = strlen($key); $passhash = hash('sha256',$passKey); $passhash = (strlen($passhash) < $len) ? hash('sha512',$passKey) : $passhash; for ($n=0; $n < $len; $n++) { $p[] = substr($passhash, $n ,1); } array_multisort($p, SORT_DESC, $i); $key = implode($i); } $base = strlen($key); if ($to_num) { $in = strrev($in); $out = 0; $len = strlen($in) - 1; for ($t = 0; $t <= $len; $t++) { $bcpow = bcpow($base, $len - $t); $out = $out + strpos($key, substr($in, $t, 1)) * $bcpow; } if (is_numeric($pad_up)) { $pad_up--; if ($pad_up > 0) { $out -= pow($base, $pad_up); } } } else { if (is_numeric($pad_up)) { $pad_up--; if ($pad_up > 0) { $in += pow($base, $pad_up); } } $out = ""; for ($t = floor(log10($in) / log10($base)); $t >= 0; $t--) { $a = floor($in / bcpow($base, $t)); $out = $out . substr($key, $a, 1); $in = $in - ($a * bcpow($base, $t)); } $out = strrev($out); } return $out; }
The text was updated successfully, but these errors were encountered:
只要加密长度超过10。。。就会出现这个现象。
Sorry, something went wrong.
No branches or pull requests
无意间发现。。20871和20872只要是这2个视频ID的进行加密。
不管是修改加密长度还是修改密匙
计算出来的加密ID竟然不一样。还不知道这种线下有多少。
如果这种情况很多。。
那直接炸裂。。。
echo mac_alphaID(20872,false,11,'abcdefggg');
function mac_alphaID($in, $to_num=false, $pad_up=false, $passKey='')
{
$key = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if (!empty($passKey)) {
for ($n = 0; $n<strlen($key); $n++) {
$i[] = substr($key,$n ,1);
}
$len = strlen($key);
$passhash = hash('sha256',$passKey);
$passhash = (strlen($passhash) < $len)
? hash('sha512',$passKey)
: $passhash;
for ($n=0; $n < $len; $n++) {
$p[] = substr($passhash, $n ,1);
}
array_multisort($p, SORT_DESC, $i);
$key = implode($i);
}
$base = strlen($key);
if ($to_num) {
$in = strrev($in);
$out = 0;
$len = strlen($in) - 1;
for ($t = 0; $t <= $len; $t++) {
$bcpow = bcpow($base, $len - $t);
$out = $out + strpos($key, substr($in, $t, 1)) * $bcpow;
}
if (is_numeric($pad_up)) {
$pad_up--;
if ($pad_up > 0) {
$out -= pow($base, $pad_up);
}
}
} else {
if (is_numeric($pad_up)) {
$pad_up--;
if ($pad_up > 0) {
$in += pow($base, $pad_up);
}
}
$out = "";
for ($t = floor(log10($in) / log10($base)); $t >= 0; $t--) {
$a = floor($in / bcpow($base, $t));
$out = $out . substr($key, $a, 1);
$in = $in - ($a * bcpow($base, $t));
}
$out = strrev($out);
}
return $out;
}
The text was updated successfully, but these errors were encountered: