New checkpr query interface checksum algorithm

Source: Internet
Author: User
Some days ago, an article N long ago suddenly became a hot topic for reading, after checking, I found that the page that I used that code for pr query could not normally get the URL PageRank value. Instead, I replaced it with a large segment of "In your email, google terms_of_service error message such as please send us the entire code displayed below. It seems that the original interface has expired.

However, the extension SearchStatus that I installed in the Firefox toolbar can still parse the prvalue of each page visited, find the plug-in package of SearchStatus to unbind the source code, and use a different verification code generation algorithm, after the original checksum is generated, another calculation is required. after the two computations, the correct ch parameter is obtained.

As a result, the new PHP version's Google PageRank query interface method came out after the ready-made js code transformation. After the local test, the terms_of_service error message is displayed after the user wants to upload the data to the server. After calculating the checksum step by step, it is found that the numbers on the local server and the server are different after several right shifts. This reminds us that the server is a 64-bit server. after the 32-bit system is displaced, the dropped bit will survive well. A trunkbitForce32bit method is added to shield the values after all arithmetic operations at a high level. This solves the extra bit problem in a 64-bit system. The result shows that the 32-bit Linux environment is incompatible because PHP automatically tries to convert int to float when the arithmetic processing overflows. When a negative overflow occurs, this operation correctly retains the precision in Windows, but there is a problem in Linux.

The following code:

$ A =-4294967295;
Echo dechex ($ )."
\ N ";
If ($ a <0) $ a + = 4294967296;
Echo dechex ($ )."
\ N ";

In Windows, the first echo can correctly output the 32-bit complement code of this negative number, while in 32-bit Linux, the output is the maximum number 0x80000000 that the int type can represent. Only by adding a large integer out of the integer range to the large negative number of the overflow in a clever way can the system restore the 32-bit low.

Using these unconventional methods, we finally developed the PHP script implementation (including the complete code) for this new version of the Google prvalue query interface compatible with Linux32, Linux64, and Windows ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.