获取Google PR值Checksum算法部分ASP版
2010-01-11 11:58:45 来源:WEB开发网<script language="javascript" runat="server">
/* -- Checksum 算法ASP源代码 -- */
/* -- http://www.eliuzd.com/pr/ -- */
/* -- 挑战者工作组倾情奉献! 作者:刘志丹 -- */
/* -- 2006-3-20 Eliuzd.com E-mail:eliuzd@gmail.com -- */
/* -- 使用方法:checksum值 = GetPR("http://www.eliuzd.com") -- */
/* -- checksum值:Google Toolbar低于2.0.114版本 -- */
function GetPR(url)
{
url ="info:" + url;
ch = GoogleCH(str_asc(url));
ch = "6" + ch
return ch;
}
function str_asc(string) {
result = new Array();
lin = string.length
for(i=0;i<lin;i++) {
result[i] = string.substring(i).charCodeAt(0);
}
return result;
}
function yiweitwo(a, b)
{
z = 0x80000000;
if (z & a)
{
a = (a>>1);
a &= (~z);
a |= 0x40000000;
a = (a>>(b-1));
}
else
{
a = (a>>b);
}
return a;
}
function yiwei(a,b,c)
{
a -= b; a -= c; a ^= (yiweitwo(c,13));
b -= c; b -= a; b ^= (a<<8);
c -= a; c -= b; c ^= (yiweitwo(b,13));
a -= b; a -= c; a ^= (yiweitwo(c,12));
b -= c; b -= a; b ^= (a<<16);
c -= a; c -= b; c ^= (yiweitwo(b,5));
a -= b; a -= c; a ^= (yiweitwo(c,3));
b -= c; b -= a; b ^= (a<<10);
c -= a; c -= b; c ^= (yiweitwo(b,15));
var myarray = new Array (a,b,c);
return myarray;
}
function GoogleCH(url)
{
length = url.length;
a = b = 0x9E3779B9;
c = 0xE6359A60;
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));
mid = yiwei(a,b,c);
a = mid[0]; b = mid[1]; c = mid[2];
k += 12;
len -= 12;
}
c += length;
switch(len)
{
case 11:
{
c+=(url[k+10]<<24);
c+=(url[k+9]<<16);
c+=(url[k+8]<<8);
b+=(url[k+7]<<24);
b+=(url[k+6]<<16);
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 10:
{
c+=(url[k+9]<<16);
c+=(url[k+8]<<8);
b+=(url[k+7]<<24);
b+=(url[k+6]<<16);
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 9 :
{
c+=(url[k+8]<<8);
b+=(url[k+7]<<24);
b+=(url[k+6]<<16);
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 8 :
{
b+=(url[k+7]<<24);
b+=(url[k+6]<<16);
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 7 :
{
b+=(url[k+6]<<16);
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 6 :
{
b+=(url[k+5]<<8);
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 5 :
{
b+=(url[k+4]);
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 4 :
{
a+=(url[k+3]<<24);
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 3 :
{
a+=(url[k+2]<<16);
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 2 :
{
a+=(url[k+1]<<8);
a+=(url[k+0]);
break;
}
case 1 :
{
a+=(url[k+0]);
break;
}
}
mid = yiwei(a,b,c);
return mid[2];
}
</script>
- ››Google运作经理Bryan Power给出的GOOGLE求职意见
- ››Google用户体验的十大设计原则
- ››Google Analytics(分析)能为网站带来什么
- ››PR取消后友情链接交换需要注意的四项原则
- ››Google goggles图片搜索 如何优化一个wap网站
- ››Google Docs将增加iPhone和Android编辑功能
- ››获取免费“高权重外链资源”的三个简单方法
- ››Pr更新是否又是个传说?
- ››Google Android操作系统内核编译图文教程
- ››Prototype1.5.0 API 参考
- ››google map api 与jquery结合使用--控件,监听器...
- ››google map api 与jquery结合使用(2) --标注,浮...
更多精彩
赞助商链接