}
function md5_G($x,$y,$z)
{
return ($x&$z)|($y&(~$z));
}
function md5_H($x,$y,$z)
{
return ($x^$y^$z);
}
function md5_I($x,$y,$z)
{
return ($y^($x|(~$z)));
}
function md5_FF(&$a,$b,$c,$d,$x,$s,$ac)
{
$a=AddUnsigned($a,AddUnsigned(AddUnsigned(md5_F($b,$c,$d),$x),$ac));
$a=RotateLeft($a,$s);
$a=AddUnsigned($a,$b);
}
function md5_GG(&$a,$b,$c,$d,$x,$s,$ac)
{
$a=AddUnsigned($a,AddUnsigned(AddUnsigned(md5_G($b,$c,$d),$x),$ac));
$a=RotateLeft($a,$s);
$a=AddUnsigned($a,$b);
}
function md5_HH(&$a,$b,$c,$d,$x,$s,$ac)
{
$a=AddUnsigned($a,AddUnsigned(AddUnsigned(md5_H($b,$c,$d),$x),$ac));
$a=RotateLeft($a,$s);
$a=AddUnsigned($a,$b);
}
function md5_II(&$a,$b,$c,$d,$x,$s,$ac)
{
$a=AddUnsigned($a,AddUnsigned(AddUnsigned(md5_I($b,$c,$d),$x),$ac));
$a=RotateLeft($a,$s);
$a=AddUnsigned($a,$b);
}
function ConvertToWordArray($sMessage)
{
$lWordArray=array();
$MODULUS_BITS=512;
$CONGRUENT_BITS=448;
$lMessageLength=strlen($sMessage);
$lNumberOfWords=(floor(($lMessageLength+floor(($MODULUS_BITS-$CONGRUENT_BITS)/BITS_TO_A_BYTE))/floor($MODULUS_BITS/BITS_TO_A_BYTE))+1)*floor($MODULUS_BITS/BITS_TO_A_WORD);
$lBytePosition=0;
$lByteCount=0;
while(!($lByteCount>=$lMessageLength))
{
$lWordCount=floor($lByteCount/BYTES_TO_A_WORD);
$lBytePosition=($lByteCount%BYTES_TO_A_WORD)*BITS_TO_A_BYTE;
$lWordArray[$lWordCount]=$lWordArray[$lWordCount]|LShift(ord(substr($sMessage,$lByteCount+1-1,1)),$lBytePosition);
$lByteCount=$lByteCount+1;
}
$lWordCount=floor($lByteCount/BYTES_TO_A_WORD);
$lBytePosition=($lByteCount%BYTES_TO_A_WORD)*BITS_TO_A_BYTE;
$lWordArray[$lWordCount]=$lWordArray[$lWordCount]|LShift(0x80,$lBytePosition);
$lWordArray[$lNumberOfWords-2]=LShift($lMessageLength,3);
$lWordArray[$lNumberOfWords-1]=RShift($lMessageLength,29);
return $lWordArray;
}
function WordToHex($lValue)
{
$tmpstr="";
for ($lCount=0; $lCount<=3; $lCount++)
本文章更多内容:<<上一页 - 1 - 2 - 3 - 4 - 5 - 6 - 下一页>> |