Thursday 1 February 2007

Google Pagerank Hacking?

Many people know Google employs some strange hash method to validate whether the input parameter is valid, especially for pageranks.
Accidentally, I just browsed the javascript file of Google Toolbar for Firefox and found something interesting. See it below:

GPR_HASH_SEED="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.";
GPR_toHex8=function(num){
return(num<16?"0":"")+num.toString(16)
};
GPR_hexEncodeU32=function(num){
var result=GPR_toHex8(num>>>24);
result+=GPR_toHex8(num>>>16&255);
result+=GPR_toHex8(num>>>8&255);
return result+GPR_toHex8(num&255)
};
GPR_awesomeHash=function(value){
var kindOfThingAnIdiotWouldHaveOnHisLuggage=16909125;
for(var i=0; i<value.length; i++){
kindOfThingAnIdiotWouldHaveOnHisLuggage^=GPR_HASH_SEED.charCodeAt(i%GPR_HASH_SEED.length)^value.charCodeAt(i);
kindOfThingAnIdiotWouldHaveOnHisLuggage=kindOfThingAnIdiotWouldHaveOnHisLuggage>>>23kindOfThingAnIdiotWouldHaveOnHisLuggage<<9
}
return GPR_hexEncodeU32(kindOfThingAnIdiotWouldHaveOnHisLuggage)
};


This is almost the original code in toolbar.js, and I made some tiny modifications to make it readable and workable. The only function that needs to be called is GPR_awesomeHash(Some_String)

The prefix GPR here must be the acronym of Google PageRank. This is the Hash method they use. It is really awesome if you read this sentence:

"Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer."

I am not willing to disobey GTOS, so I will not give you the code to get pagerank value.

You can do that yourself. It is quite easy. Yes, I'm talking to you, scammer.

What I am interested in is actually something else, say "Google Dictionary"?
Using Google Toolbar, we can translate most English word to our own language by pointing the word. Usually, this dictionary is in some DAT files in the plugin folder which seems not too difficult to crack. You may try!

But Google also offers an online interface to retrieve word meaning. Luckily, they use the same hash method. The URL format is below:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=SomeEnglishWord&langpair=en%7CLanguageCode&sig=HashCode

Language code: zh-CN for simplified Chinese, fr for French, jp for japanese, etc
Hash code: "8"+GPR_awesomeHash(the english word you look up for)

The number 8 is kind of miracle. Also, in the hashmethod, the number 16909125 may have some special meaning, too. Yet, I don't know.

Here are some example links for this dictionary, the word is HAPPY
Simplified Chinese:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Czh-CN&sig=8b0082ea0

Traditional Chinese:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Czh-TW&sig=8b0082ea0

French:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Cfr&sig=8b0082ea0

Korean:
http://www.google.com/tbproxy/dictionary?ie=UTF-8&oe=UTF-8&text=happy&langpair=en%7Cko&sig=8b0082ea0

No comments:

Post a Comment