亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1363 | 回復(fù): 0
打印 上一主題 下一主題

用PHP寫的MD5加密函數(shù) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2005-04-18 12:27 |只看該作者 |倒序瀏覽

搞到啦,怎么調(diào)用啊
用PHP寫的MD5加密函數(shù)
//php_md5("字符串")
define("BITS_TO_A_BYTE",8);
define("BYTES_TO_A_WORD",4);
define("BITS_TO_A_WORD",32);
$m_lOnBits=array(30);
$m_l2Power=array(30);
function LShift($lValue,$iShiftBits)
{
        if ($iShiftBits==0) return $lValue;
        if ($iShiftBits==31)
        {
                if ($lValue&1) { return 0x80000000; }
                else { return 0; }
        }
        if ($iShiftBits  31) { }
        if (($lValue&$GLOBALS[31-$iShiftBits]))
        {        $tmpstr=(($lValue&$GLOBALS[31-($iShiftBits+1)])*$GLOBALS[$iShiftBits])|0x80000000; }
        else
        { $tmpstr=(($lValue&$GLOBALS[31-$iShiftBits])*$GLOBALS[$iShiftBits]); }
        return $tmpstr;
}
function RShift($lValue,$iShiftBits)
{
        if ($iShiftBits==0)return $lValue;
        if ($iShiftBits==31)
        {
                if ($lValue&0x80000000) { return 1; }
                else { return 0; }
        }
        if ($iShiftBits31) { }
        $tmpstr=floor(($lValue&0x7FFFFFFE)/$GLOBALS[$iShiftBits]);
        if ($lValue&0x80000000) { $tmpstr=$tmpstr|floor(0x40000000/$GLOBALS[$iShiftBits-1]); }
        return $tmpstr;
}
function RotateLeft($lValue,$iShiftBits)
{
        return LShift($lValue,$iShiftBits)|RShift($lValue,(32-$iShiftBits));
}
function AddUnsigned($lX,$lY)
{
        $lX8=$lX&0x80000000;
        $lY8=$lY&0x80000000;
        $lX4=$lX&0x40000000;
        $lY4=$lY&0x40000000;
        $lResult=($lX&0x3FFFFFFF)+($lY&0x3FFFFFFF);
        if ($lX4&$lY4) { $lResult=$lResult^0x80000000^$lX8^$lY8; }
        if ($lX4|$lY4)
        {
                if ($lResult&0x40000000)
                { $lResult=$lResult^0xC0000000^$lX8^$lY8; }
                else
                { $lResult=$lResult^0x40000000^$lX8^$lY8; }
        }
        else
        { $lResult=$lResult^$lX8^$lY8; }
        return $lResult;
}
function md5_F($x,$y,$z)
{
        return ($x&$y)|((~$x)&$z);
}
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; $lCountfunction php_MD5($sMessage)
{
        $GLOBALS[0]=intval(1);
        $GLOBALS[1]=intval(3);
        $GLOBALS[2]=intval(7);
        $GLOBALS[3]=intval(15);
        $GLOBALS[4]=intval(31);
        $GLOBALS[5]=intval(63);
        $GLOBALS[6]=intval(127);
        $GLOBALS[7]=intval(255);
        $GLOBALS[8]=intval(511);
        $GLOBALS[9]=intval(1023);
        $GLOBALS[10]=intval(2047);
        $GLOBALS[11]=intval(4095);
        $GLOBALS[12]=intval(8191);
        $GLOBALS[13]=intval(16383);
        $GLOBALS[14]=intval(32767);
        $GLOBALS[15]=intval(65535);
        $GLOBALS[16]=intval(131071);
        $GLOBALS[17]=intval(262143);
        $GLOBALS[18]=intval(524287);
        $GLOBALS[19]=intval(1048575);
        $GLOBALS[20]=intval(2097151);
        $GLOBALS[21]=intval(4194303);
        $GLOBALS[22]=intval(8388607);
        $GLOBALS[23]=intval(16777215);
        $GLOBALS[24]=intval(33554431);
        $GLOBALS[25]=intval(67108863);
        $GLOBALS[26]=intval(134217727);
        $GLOBALS[27]=intval(268435455);
        $GLOBALS[28]=intval(536870911);
        $GLOBALS[29]=intval(1073741823);
        $GLOBALS[30]=intval(2147483647);
        $GLOBALS[0]=intval(1);
        $GLOBALS[1]=intval(2);
        $GLOBALS[2]=intval(4);
        $GLOBALS[3]=intval(8);
        $GLOBALS[4]=intval(16);
        $GLOBALS[5]=intval(32);
        $GLOBALS[6]=intval(64);
        $GLOBALS[7]=intval(128);
        $GLOBALS[8]=intval(256);
        $GLOBALS[9]=intval(512);
        $GLOBALS[10]=intval(1024);
        $GLOBALS[11]=intval(2048);
        $GLOBALS[12]=intval(4096);
        $GLOBALS[13]=intval(8192);
        $GLOBALS[14]=intval(16384);
        $GLOBALS[15]=intval(32768);
        $GLOBALS[16]=intval(65536);
        $GLOBALS[17]=intval(131072);
        $GLOBALS[18]=intval(262144);
        $GLOBALS[19]=intval(524288);
        $GLOBALS[20]=intval(1048576);
        $GLOBALS[21]=intval(2097152);
        $GLOBALS[22]=intval(4194304);
        $GLOBALS[23]=intval(8388608);
        $GLOBALS[24]=intval(16777216);
        $GLOBALS[25]=intval(33554432);
        $GLOBALS[26]=intval(67108864);
        $GLOBALS[27]=intval(134217728);
        $GLOBALS[28]=intval(268435456);
        $GLOBALS[29]=intval(536870912);
        $GLOBALS[30]=intval(1073741824);
        $S11=7;
        $S12=12;
        $S13=17;
        $S14=22;
        $S21=5;
        $S22=9;
        $S23=14;
        $S24=20;
        $S31=4;
        $S32=11;
        $S33=16;
        $S34=23;
        $S41=6;
        $S42=10;
        $S43=15;
        $S44=21;
        $x=ConvertToWordArray($sMessage);
        $a=0x67452301;
        $b=0xEFCDAB89;
        $c=0x98BADCFE;
        $d=0x10325476;
        for ($k=0; $k


本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/4849/showart_21905.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP