We found on the QQ online hash encryption algorithm is the JS version, the following we are based on the JS version of the hash encryption algorithm to PHP version of the encryption algorithm, I hope the method for you to help.
As a result of the recent mass of QQ spam, the official choice will webqq part of the function to achieve the details of some hands and feet. Which gets the post value of a friend more than a hash parameter.
This hash is encrypted in JS.
The following is the JS source code
The code is as follows |
Copy Code |
|
Converted to PHP version processing, the source code is as follows
The code is as follows |
Copy Code |
/** * Post parameter hash algorithm when getting a friend * * Public * @param string $QQ QQ number * @param string $ptwebqq ptwebqq in cookies * @return String */ function Get_hash ($QQ, $PTWEBQQ) { for ($a = $ptwebqq. "Password Error", $s = "", $j = Array ();;) { if (strlen ($s) <= strlen ($a)) { $s. = $QQ; if ($s = = strlen ($a)) break; } Else { $s = substr ($s, 0, strlen ($a)); Break } } for ($d = 0; $d < strlen ($s); $d + +) { $j [$d] = Uniord (substr ($s, $d)) ^ Uniord (substr ($a, $d)); } $a = Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "B", "C", "D", "E", "F"); $s = ""; for ($d = 0; $d < count ($j); $d + +) { $s. = $a [$j [$d] >> 4 & 15]; $s. = $a [$j [$d] & 15]; } return $s; } /** * Analog JavaScript charCodeAt function * * Protected * @param string $str * @return int */ function Uniord ($STR) { List (, $ord) = Unpack (' N ', mb_convert_encoding ($str, ' ucs-4be ', ' UTF-8 ')); Return |
$ord;
}
/* End of File commons.php */
http://www.bkjia.com/PHPjc/632811.html www.bkjia.com true http://www.bkjia.com/PHPjc/632811.html techarticle we found on the QQ online hash encryption algorithm is the JS version, the following we are based on the JS version of the hash encryption algorithm to PHP version of the encryption algorithm, I hope the method for you to help. Because of the recent Q ...