06-21-2006, 04:44 PM | #271 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jun 2006
|
I can't get it to work!
Hi guys,
I still can't get it to work. Has anybody got a working version? Can you post the code here so that we all can use it? Thanks Ali |
06-27-2006, 08:28 PM | #272 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jun 2006
Location: mexico
|
A working google checksum algorithm and other stuff
Hi there:
This is a working 64bit version of the google checksum algorithm. Enjoy it TO use it : $checksum= new google_checksum(); $ch="6".$checksum->getGoogleChecksum('domain.com'); And the class: <?PHP /* Written and contributed by Alex Stapleton, Andy Doctorow, Tarakan, Bill Zeller, Vijay "Cyberax" Bhatter traB This code is released into the public domain */ define('GOOGLE_MAGIC', 0xE6359A60); class google_checksum{ var $checksum; function google_checksum(){ $this->checksum=''; } //unsigned shift right function zeroFill($a, $b){ $z = hexdec(80000000); if ($z & $a) { $a = ($a>>1); $a &= (~$z); $a |= 0x40000000; $a = ($a>>($b-1)); } else { $a = ($a>>$b); } return $a; } function mixOld($a,$b,$c) { $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,13)); $b -= $c; $b -= $a; $b ^= ($a<<8); $c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,13)); $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,12)); $b -= $c; $b -= $a; $b ^= ($a<<16); $c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,5)); $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,3)); $b -= $c; $b -= $a; $b ^= ($a<<10); $c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,15)); return array($a,$b,$c); } function mix($a,$b,$c) { $a -= $b; $a -= $c; $this->toInt32($a); $a = (int)($a ^ ($this->zeroFill($c,13))); $b -= $c; $b -= $a; $this->toInt32($b); $b = (int)($b ^ ($a<<8)); $c -= $a; $c -= $b; $this->toInt32($c); $c = (int)($c ^ ($this->zeroFill($b,13))); $a -= $b; $a -= $c; $this->toInt32($a); $a = (int)($a ^ ($this->zeroFill($c,12))); $b -= $c; $b -= $a; $this->toInt32($b); $b = (int)($b ^ ($a<<16)); $c -= $a; $c -= $b; $this->toInt32($c); $c = (int)($c ^ ($this->zeroFill($b,5))); $a -= $b; $a -= $c; $this->toInt32($a); $a = (int)($a ^ ($this->zeroFill($c,3))); $b -= $c; $b -= $a; $this->toInt32($b); $b = (int)($b ^ ($a<<10)); $c -= $a; $c -= $b; $this->toInt32($c); $c = (int)($c ^ ($this->zeroFill($b,15))); return array($a,$b,$c); } //converts a string into an array of integers containing the numeric value of the char function strord($string){ for($i=0;$i<strlen($string);$i++) { $result[$i] = ord($string{$i}); } return $result; } // calculates the google checksum function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC){ if(is_null($length)) { $length = sizeof($url); } $a = $b = 0x9E3779B9; $c = $init; $k = 0; $len = $length; while($len >= 12) { $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24)); $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24)); $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24)); $mix = $this->mix($a,$b,$c); $a = $mix[0]; $b = $mix[1]; $c = $mix[2]; $k += 12; $len -= 12; } $c += $length; switch($len) /* all the case statements fall through */ { case 11: $c+=($url[$k+10]<<24); case 10: $c+=($url[$k+9]<<16); case 9 : $c+=($url[$k+8]<<8); /* the first byte of c is reserved for the length */ case 8 : $b+=($url[$k+7]<<24); case 7 : $b+=($url[$k+6]<<16); case 6 : $b+=($url[$k+5]<<8); case 5 : $b+=($url[$k+4]); case 4 : $a+=($url[$k+3]<<24); case 3 : $a+=($url[$k+2]<<16); case 2 : $a+=($url[$k+1]<<8); case 1 : $a+=($url[$k+0]); /* case 0: nothing left to add */ } $mix = $this->mix($a,$b,$c); /*-------------------------------------------- report the result */ return $mix[2]; } // converts an array of 32 bit integers into an array with 8 bit values. Equivalent to (BYTE *)arr32 function c32to8bit($arr32){ for($i=0;$i<count($arr32);$i++) { for ($bitOrder=$i*4;$bitOrder<=$i*4+3;$bitOrder++) { $arr8[$bitOrder]=$arr32[$i]&255; $arr32[$i]=zeroFill($arr32[$i], 8); } } return $arr8; } // gets the google checksum! function getGoogleChecksum($url){ $url="info:"."http://".str_replace('http://','',$url); $tmp_ch=$this->strord($url); $this->checksum=sprintf("%u", $this->GoogleCH($tmp_ch)); return $this->checksum; } // converts 64 bit 2 32 bit function toInt32(& $x){ $z = hexdec(80000000); $y = (int)$x; // on 64bit OSs if $x is double, negative ,will return -$z in $y // which means 32th bit set (the sign bit) if($y==-$z&&$x<-$z){ $y = (int)((-1)*$x);// this is the hack, make it positive before $y = (-1)*$y; // switch back the sign //echo "int hack <br>"; } $x = $y; } } ?> |
Advert | |
|
07-26-2006, 01:52 AM | #273 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jul 2006
|
I have read every post here, and my php skills are not what I thought they were. I have worked at getting a 32bit version working on my PHP4 box for several hours. Could someone please post the newest working version.
|
08-16-2006, 10:56 AM | #274 | |
Junior Member
Posts: 7
Karma: 24
Join Date: Sep 2005
|
hi,gamesaga back
Quote:
http://home.zhiwei.li/pagerank/ Google Toolbar 5.0.x for IE (difficult) Google Toolbar for Firefox (easy) Last edited by AboutSledge; 08-20-2008 at 02:38 AM. |
|
08-26-2006, 05:28 AM | #275 | |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2006
|
I tried the code below, but I also could not get it to work on my 64 bit server.
I added the lines PHP Code:
but whenever it was run it gives a value of -1 which is that thing that happens when I use the code for a 32 bit machine. Can anyone help me (all of us) on this? Maybe someone has got it working, if so can you please post the code here. Thanks Quote:
|
|
Advert | |
|
08-27-2006, 07:37 AM | #276 |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2006
|
OK i got it working now
|
08-27-2006, 04:48 PM | #277 |
Junior Member
Posts: 3
Karma: 10
Join Date: Aug 2006
|
Ok, I thought I had it working but some websites give an error. Can anyone help me with this?
Thanks |
09-08-2006, 07:58 AM | #278 | |
Junior Member
Posts: 1
Karma: 10
Join Date: Sep 2006
|
I get
int(-6288256054) int(-6288256054) int(-6288256054) int(-6288256054) Host provider is bluehost and PHP 4.4.4 (cgi) Linux 2.6.17-11_1.BHsmp #1 SMP Thu Aug 24 09:39:29 MDT 2006 x86_64 x86_64 x86_64 GNU/Linux Not a single example here to fetch pr work there =( Me http://www.findmatch.org 100% Free dating & penpals service Quote:
Last edited by bonusrobber; 09-08-2006 at 08:14 AM. |
|
09-14-2006, 01:34 PM | #279 |
Junior Member
Posts: 5
Karma: 10
Join Date: Sep 2006
|
I've tried all the scripts on here, and I appear to have a problem generating the ch correctly, which is apparently down to an issue with the way certain versions of PHP handle the bitwise operations. Any ideas on a fix?
I have documented my findings here: http://www.googlecommunity.com/about14098.html My Server information: Operating system CentOS Linux Kernel version 2.6.8-022stab078.14-smp Machine Type i686 Apache version 1.3.37 (Unix) PERL version 5.8.7 PHP version 4.4.4 MySQL version 4.1.21-standard cPanel Build 10.8.2-RELEASE 119 If you think you can resolve this problem, I will give you an account on my server to attempt a solution. |
09-20-2006, 10:33 PM | #280 | |
Junior Member
Posts: 7
Karma: 24
Join Date: Sep 2005
|
Quote:
Maybe I can resolve it. GTalk/MSN/E-Mail: anykai [at] gmail <dot> com |
|
10-09-2006, 08:47 PM | #281 |
Junior Member
Posts: 5
Karma: 10
Join Date: Sep 2006
|
There is still no working solution for people with newer version of PHP...
|
10-18-2006, 07:19 AM | #282 |
Junior Member
Posts: 7
Karma: 24
Join Date: Sep 2005
|
google toolbar 4.0.x checksum algo
Server-side scripting demo http://pagerank.gamesaga.net/ PHP Server-side scripting source code http://pagerank.gamesaga.net/pagerank.zip source code for Python http://pagerank.gamesaga.net/pagerank.txt source code for C http://pagerank.gamesaga.net/pagerank.c 2005-09-13 v0.1 first release 2005-10-21 v1.1 fix a bug for the final character 2006-09-21 v1.2 compatible with PHP 4.4/PHP 5.x 2006-09-29 v1.3 X86_64 CPU supported Any suggestions and feedback is welcome. ps: this script works on hm2k's server which is i686 arch Last edited by AboutSledge; 10-18-2006 at 07:24 AM. |
02-08-2007, 09:23 AM | #283 |
Junior Member
Posts: 5
Karma: 10
Join Date: Sep 2006
|
In addition to this, i've released some background about this here:
http://www.hm2k.com/projects/pagerank/ |
05-21-2007, 08:43 PM | #284 |
Junior Member
Posts: 1
Karma: 10
Join Date: May 2007
|
nice work
|
11-26-2007, 12:20 PM | #285 |
Junior Member
Posts: 1
Karma: 10
Join Date: Nov 2007
Device: Sony Ericsson W800i
|
page rank for mysql
Hello guys!
This script is awesome! thank you.. Now i want some other help.. I want to save the pagerank in mysql, because i have lots of websites saved in mysql and i displayed sort option for other columns, but i cannot sort by page rank. So is there any option so i could save pagerank function in my mysql or any other solution to make it sortable? thank you for quick reply.. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Seriously thoughtful Dekker's Algorithm help. | Catire | Lounge | 13 | 03-19-2010 10:03 AM |
Bulk Pagerank Checker Script? | SNaRe | Lounge | 2 | 10-22-2006 04:36 PM |
Google Toolbar Pagerank Checksum Revealed! | Alexander Turcic | Lounge | 5 | 02-17-2006 08:09 AM |
Google Checksum CH calculator | cyberax | Lounge | 2 | 08-17-2004 09:37 PM |