WEB开发网
开发学院软件开发数据结构 获取Google PR值Checksum算法部分ASP版 阅读

获取Google PR值Checksum算法部分ASP版

 2010-01-11 11:58:45 来源:WEB开发网   
核心提示:<script language="javascript" runat="server">/* -- Checksum 算法ASP源代码 -- *//* -- http://www.eliuzd.com/pr/ -- *//* -- 挑战者工作组倾情奉献! 作者:刘志

<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>

Tags:获取 Google PR

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接