色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

php異或算法

錢琪琛2年前36瀏覽0評論

php異或算法?

/**

* PHP字符串“異或”算法

* param array key

* @param Request $request

* @return mixed|string|void

*/

public function setSecretKey(Request $request){

$keyArr = $request->input('key');

if(!is_array($keyArr) || empty($keyArr))

return;

foreach ($keyArr as $v){

if(empty($v) || (strlen($v) != 32)){

return;

}

}

if(count($keyArr) == 1)

return $keyArr[0];

$arrLength = count($keyArr);

$initKey = "00000000000000000000000000000000";

$initKeyArr = str_split($initKey);

for($i = 0;$i < $arrLength;$i++){

$newKey = '';

for($j = 0;$j < strlen($keyArr[$i]);$j++){

$str = '';

$tmpArr = str_split($keyArr[$i]);

$tmpA = str_pad(base_convert($tmpArr[$j],16,2),4,0,STR_PAD_LEFT);

$tmpB = str_pad(base_convert($initKeyArr[$j],16,2),4,0,STR_PAD_LEFT);

for($k=0;$k<strlen($tmpA);$k++){

$str .=(intval($tmpA[$k]) ^ intval($tmpB[$k]));

}

$tmpOneKey = strtoupper(base_convert($str,2,16));

unset($str);

$newKey .= $tmpOneKey;

}

unset($initKeyArr);

$initKeyArr = str_split($newKey);

}

return join($initKeyArr);

}

php的字符串是什么類型,php異或算法