惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Cyberwarzone
Cyberwarzone
L
LINUX DO - 最新话题
N
News and Events Feed by Topic
T
Troy Hunt's Blog
Help Net Security
Help Net Security
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
M
MIT News - Artificial intelligence
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
SegmentFault 最新的问题
I
InfoQ
H
Hacker News: Front Page
D
Docker
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
博客园 - 【当耐特】
T
Tor Project blog
U
Unit 42
H
Heimdal Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Privacy & Cybersecurity Law Blog
PCI Perspectives
PCI Perspectives
美团技术团队
O
OpenAI News
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
GbyAI
GbyAI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MyScale Blog
MyScale Blog

博客园 - viii

第一课:什么是Google排名技术 网络推手离企业营销有多远? 国内外主要搜索引擎登陆地址 Google推广的价值是什么? 搜索引擎优化(SEO)类网站设计 网站建设与搜索引擎优化的不可分性 pligg乱码的解决办法(9.8) 为什么DIV+CSS有利排名 什么是搜索引擎推广 登录搜索引擎常见问题 搜索引擎优化不是网页标签优化 邮件营销 Google登录与设计 网站排名—域名 实用搜索技巧 SEO中的“白帽” “黑帽” 影响SEO49个网站排名的因素 怎么把从搜索引擎来的用户留下? 网站规划与优化的技巧
Google PageRank的计算源代码
viii · 2007-10-21 · via 博客园 - viii

最近对google的PageRank(网页等级)比较感兴趣,一直想知道如何不用google toolbar来获取pr值。苦苦搜索之后,找到如下代码:

<?php

/**

    This code is released unto the public domain

*/

//header("Content-Type: text/plain; charset=utf-8");

define('GOOGLE_MAGIC', 0xE6359A60);

//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 mix($a,$b,$c) {

  $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));

  $b -= $c; $b -= $a; $b ^= ($a<<8);

  $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));

  $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));

  $b -= $c; $b -= $a; $b ^= ($a<<16);

  $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));

  $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));

  $b -= $c; $b -= $a; $b ^= ($a<<10);

  $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));

  return array($a,$b,$c);

}

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 = 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 = mix($a,$b,$c);

    /*-------------------------------------------- report the result */

    return $mix[2];

}

//converts a string into an array of integers containing the numeric value of the char