PHP获取PR值的代码(2)
$b -= $c;$b = trunkbitForce32bit($b);
$b -= $a;$b = trunkbitForce32bit($b);
$b = bigxor($b,trunkbitForce32bit($a<<16));
$c -= $a; $c = trunkbitForce32bit($c);
$c -= $b; $c = trunkbitForce32bit($c);
$c = bigxor($c,(zeroFill($b,5))); $c = trunkbitForce32bit($c);
$a -= $b;$a = trunkbitForce32bit($a);
$a -= $c;$a = trunkbitForce32bit($a);
$a = bigxor($a,(zeroFill($c,3)));$a = trunkbitForce32bit($a);
$b -= $c;$b = trunkbitForce32bit($b);
$b -= $a;$b = trunkbitForce32bit($b);
$b = bigxor($b,trunkbitForce32bit($a<<10));
$c -= $a; $c = trunkbitForce32bit($c);
$c -= $b; $c = trunkbitForce32bit($c);
$c = bigxor($c,(zeroFill($b,15))); $c = trunkbitForce32bit($c);
return array($a,$b,$c);
}
function NewGCH($ch){
$ch = ( trunkbitForce32bit( ( $ch / 7 ) << 2 ) |
( ( myfmod( $ch,13 ) ) & 7 ) );
$prbuf = array();
$prbuf[0] = $ch;
for( $i = 1; $i < 20; $i++ )
{
$prbuf[$i] = $prbuf[$i-1] - 9;
}
$ch = GCH( c32to8bit( $prbuf ) );
return $ch;
}
function myfmod($x,$y){
$i = floor( $x / $y );
return ( $x - $i * $y );
}
function c32to8bit($arr32){
$arr8 = array();
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;
}
function GCH($url, $length=null){
if(is_null($length)) {
$length = sizeof($url);
}
$init = 0xE6359A60;
$a = 0x9E3779B9;
$b = 0x9E3779B9;
$c = 0xE6359A60;
$k = 0;
$len = $length;
$mixo = array();
while( $len >= 12 ){
$a += ($url[$k+0] +trunkbitForce32bit($url[$k+1]<<8)
+trunkbitForce32bit($url[$k+2]<<16)
+trunkbitForce32bit($url[$k+3]<<24));
$b += ($url[$k+4] +trunkbitForce32bit($url[$k+5]<<8)
+trunkbitForce32bit($url[$k+6]<<16)
+trunkbitForce32bit($url[$k+7]<<24));
$c += ($url[$k+8] +trunkbitForce32bit($url[$k+9]<<8)
+trunkbitForce32bit($url[$k+10]<<16)
+trunkbitForce32bit($url[$k+11]<<24));
$mixo = mix($a,$b,$c);
$a = $mixo[0]; $b = $mixo[1]; $c = $mixo[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch( $len ) {
case 11:
$c += trunkbitForce32bit($url[$k+10]<<24);
case 10:
$c+=trunkbitForce32bit($url[$k+9]<<16);
case 9 :
$c+=trunkbitForce32bit($url[$k+8]<<8);
case 8 :
$b+=trunkbitForce32bit($url[$k+7]<<24);
case 7 :
$b+=trunkbitForce32bit($url[$k+6]<<16);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>