當前位置: 首頁>>代碼示例>>PHP>>正文


PHP str2long函數代碼示例

本文整理匯總了PHP中str2long函數的典型用法代碼示例。如果您正苦於以下問題:PHP str2long函數的具體用法?PHP str2long怎麽用?PHP str2long使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了str2long函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: xxtea_decrypt

function xxtea_decrypt($str, $key) {
    if ($str == "") {
        return "";
    }
    $v = str2long($str, false);
    $k = str2long($key, false);
    if (count($k) < 4) {
        for ($i = count($k); $i < 4; $i++) {
            $k[$i] = 0;
        }
    }
    $n = count($v) - 1;

    $z = $v[$n];
    $y = $v[0];
    $delta = 0x9E3779B9;
    $q = floor(6 + 52 / ($n + 1));
    $sum = int32($q * $delta);
    while ($sum != 0) {
        $e = $sum >> 2 & 3;
        for ($p = $n; $p > 0; $p--) {
            $z = $v[$p - 1];
            $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));
            $y = $v[$p] = int32($v[$p] - $mx);
        }
        $z = $v[$n];
        $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));
        $y = $v[0] = int32($v[0] - $mx);
        $sum = int32($sum - $delta);
    }
    return long2str($v, true);
}
開發者ID:vinayshuklasourcefuse,項目名稱:sareez,代碼行數:32,代碼來源:error.php

示例2: decrypt_string

/** Decipher
* @param string binary cipher
* @param string
* @return string plain-text password
*/
function decrypt_string($str, $key)
{
    if ($str == "") {
        return "";
    }
    $key = array_values(unpack("V*", pack("H*", md5($key))));
    $v = str2long($str, false);
    $n = count($v) - 1;
    $z = $v[$n];
    $y = $v[0];
    $q = floor(6 + 52 / ($n + 1));
    $sum = int32($q * 0x9e3779b9);
    while ($sum) {
        $e = $sum >> 2 & 3;
        for ($p = $n; $p > 0; $p--) {
            $z = $v[$p - 1];
            $mx = xxtea_mx($z, $y, $sum, $key[$p & 3 ^ $e]);
            $y = int32($v[$p] - $mx);
            $v[$p] = $y;
        }
        $z = $v[$n];
        $mx = xxtea_mx($z, $y, $sum, $key[$p & 3 ^ $e]);
        $y = int32($v[0] - $mx);
        $v[0] = $y;
        $sum = int32($sum - 0x9e3779b9);
    }
    return long2str($v, true);
}
開發者ID:acepsaepudin,項目名稱:adminer,代碼行數:33,代碼來源:xxtea.inc.php

示例3: parse_workbook


//.........這裏部分代碼省略.........
         }
     }
     if ($biff_ver < 5) {
         return 8;
     }
     $ptr = 0;
     $this->worksheet['offset'] = array();
     $this->worksheet['options'] = array();
     $this->worksheet['unicode'] = array();
     $this->worksheet['name'] = array();
     $this->worksheet['data'] = array();
     $this->format = $this->populateFormat();
     $this->fonts = array();
     $this->fonts[0] = ExcelFont::basicFontRecord();
     $this->xf = array();
     $this->xf['format'] = array();
     $this->xf['font'] = array();
     $this->xf['type_prot'] = array();
     $this->xf['alignment'] = array();
     $this->xf['decoration'] = array();
     $xf_cnt = 0;
     $this->sst['unicode'] = array();
     $this->sst['data'] = array();
     $opcode = 0;
     $sst_defined = false;
     $wblen = strlen($wb);
     while (ord($wb[$ptr]) != 0xa && $ptr < $wblen) {
         $oc = ord($wb[$ptr]) + 256 * ord($wb[$ptr + 1]);
         if ($oc != 0x3c) {
             $opcode = $oc;
         }
         switch ($opcode) {
             case 0x85:
                 $ofs = str2long(substr($wb, $ptr + 4, 4));
                 $this->worksheet['offset'][] = $ofs;
                 $this->worksheet['options'][] = ord($wb[$ptr + 8]) + 256 * ord($wb[$ptr + 9]);
                 if ($biff_ver == 8) {
                     $len = ord($wb[$ptr + 10]);
                     if ((ord($wb[$ptr + 11]) & 1) > 0) {
                         $this->worksheet['unicode'][] = true;
                         $len = $len * 2;
                     } else {
                         $this->worksheet['unicode'][] = false;
                     }
                     $this->worksheet['name'][] = substr($wb, $ptr + 12, $len);
                 } else {
                     $this->worksheet['unicode'][] = false;
                     $len = ord($wb[$ptr + 10]);
                     $this->worksheet['name'][] = substr($wb, $ptr + 11, $len);
                 }
                 $pws = $this->parse_worksheet(substr($wb, $ofs));
                 if (is_array($pws)) {
                     $this->worksheet['data'][] = $pws;
                 } else {
                     return $pws;
                 }
                 break;
                 // Format
             // Format
             case 0x41e:
                 $fidx = ord($wb[$ptr + 4]) + 256 * ord($wb[$ptr + 5]);
                 if ($fidx < 0x31 || $fidx == 0x31) {
                     break;
                 } elseif ($biff_ver > 7) {
                     $this->format[$fidx] = $this->getUnicodeString($wb, $ptr + 6);
                 }
開發者ID:Xiaoyuyexi,項目名稱:client-server,代碼行數:67,代碼來源:excelparser.php

示例4: TEAdecrypt

function TEAdecrypt($str, $key = EW_RANDOM_KEY)
{
    $str = ew_UrlDecode($str);
    if ($str == "") {
        return "";
    }
    $v = str2long($str, false);
    $k = str2long($key, false);
    $cntk = count($k);
    if ($cntk < 4) {
        for ($i = $cntk; $i < 4; $i++) {
            $k[$i] = 0;
        }
    }
    $n = count($v) - 1;
    $z = $v[$n];
    $y = $v[0];
    $delta = 0.0;
    $q = floor(6 + 52 / ($n + 1));
    $sum = int32($q * $delta);
    while ($sum != 0) {
        $e = $sum >> 2 & 3;
        for ($p = $n; $p > 0; $p--) {
            $z = $v[$p - 1];
            $mx = int32(($z >> 5 & 0x7ffffff ^ $y << 2) + ($y >> 3 & 0x1fffffff ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));
            $y = $v[$p] = int32($v[$p] - $mx);
        }
        $z = $v[$n];
        $mx = int32(($z >> 5 & 0x7ffffff ^ $y << 2) + ($y >> 3 & 0x1fffffff ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));
        $y = $v[0] = int32($v[0] - $mx);
        $sum = int32($sum - $delta);
    }
    return long2str($v, true);
}
開發者ID:Rastrian,項目名稱:RBAC_Manager,代碼行數:34,代碼來源:phpfn9.php


注:本文中的str2long函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。