Pagerank Checksum in Java
October 11th, 2006
A quick java class to calculate a web pages Page Rank Checksum. It can be used to obtian the Google Page Rank for a given url.The code is reverse engineered from the javascript used to build the Firefox page rank plugin. It calculates a checksum using a encoding algorithm.
[java]
public class Pagerank
{
private String toHex8(int num)
{
if(num<16) return "0"+Integer.toHexString(num);
else return Integer.toHexString(num);
}
public String calculateChecksum(String url)
{
String stupidGoogleHash = "Mining PageRank is AGAINST GOOGLE’S TERMS OF SERVICE. Yes, I’m talking to you, scammer.";
int key = 16909125;
for(int i=0; i < url.length(); i++) {
key = key ^ (int)(stupidGoogleHash.charAt(i%stupidGoogleHash.length()))^(int)(url.charAt(i));
key = key>>>23|key<<9;
}return "8"+toHex8(key>>>(8&255))+toHex8(key&255);
}
}[/java]
Tags: Java
Thank you for the great example. It worked like a charm. Time for me to really learn some java now!
I’d love to see an updated function in PHP that calculates the PageRank checksum. Any ideas? … meanwhile, googling..
I have one for PHP as well, let me see if i can dig it up
EDIT:
okay you can find the php version here Â
this is suitable and esiest program avialable here.
thanks ,great work
Has there been an update to the google toolbar or something?
I can’t get it to work…. seems to be wrong checksum
I wrote the code a long long time ago. So it very possible that a google update has broken it.