当前位置: 首页>>代码示例>>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;未经允许,请勿转载。