当前位置: 首页>>代码示例>>PHP>>正文


PHP Math_BigInteger::toString方法代码示例

本文整理汇总了PHP中Math_BigInteger::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Math_BigInteger::toString方法的具体用法?PHP Math_BigInteger::toString怎么用?PHP Math_BigInteger::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Math_BigInteger的用法示例。


在下文中一共展示了Math_BigInteger::toString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param $pem_format
  * @param string $password
  * @throws RSABadPEMFormat
  */
 public function __construct($pem_format, $password = null)
 {
     parent::__construct($pem_format, $password);
     $this->d = $this->rsa_imp->exponent;
     if ($this->d->toString() === $this->e->toString()) {
         throw new RSABadPEMFormat(sprintf('pem %s is a public key!', $pem_format));
     }
 }
开发者ID:smarcet,项目名称:jose4php,代码行数:13,代码来源:_RSAPrivateKeyPEMFornat.php

示例2: bcdechex

}
echo "\n\n" . sprintf('%f', $weisummary) . ' wei';
$current .= "\n\n" . sprintf('%f', $weisummary) . ' wei';
echo "\n\n" . sprintf('%f', $withdrawcount) . ' withdraw Count';
$current .= "\n\n" . sprintf('%f', $withdrawcount) . ' withdraw Count';
$data = array("jsonrpc" => "2.0", "method" => "eth_getBalance", "params" => [$coinbase, 'latest'], "id" => 1);
$data_string = json_encode($data);
$ch1 = curl_init('http://127.0.0.1:8983');
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
$result3 = curl_exec($ch1);
$block_info_last = json_decode($result3, true);
$escapeDot = explode('.', sprintf('%f', hexdec($block_info_last['result'])));
$balanceaddr = new Math_BigInteger($escapeDot[0]);
$updatebalanceaddr = $balanceaddr->toString();
$task = "UPDATE info SET balance='{$updatebalanceaddr}' WHERE id=1;";
$query = mysqli_query($mysqli, $task) or die("Database Error");
file_put_contents($file, $current);
$m->set('state_work', 0);
function bcdechex($dec)
{
    $hex = '';
    do {
        $last = bcmod($dec, 16);
        $hex = dechex($last) . $hex;
        $dec = bcdiv(bcsub($dec, $last), 16);
    } while ($dec > 0);
    return $hex;
}
开发者ID:utocat,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例3: strlen

     }
 } else {
     $balanceToSave = $balanceaddr;
     echo "\nBlocksize normal PLAIN";
     $current .= "\nBlocksize normal PLAIN";
 }
 $too_bigg = new Math_BigInteger('12000000000000000000');
 if ($block_coins_size > $too_bigg) {
     $block_coins_size = $standart_block_size;
     echo "\nBlocksize normal _FIXXX";
     $current .= "\nBlocksize normal _FIXXX";
 }
 $Lenght = strlen($block_coins_size->toString());
 echo "\nLenght1:" . $Lenght;
 $current .= "\nLenght1:" . $Lenght;
 $big_ta = strlen($too_bigg->toString());
 echo "\nLenght2:" . $big_ta;
 $current .= "\nLenght2:" . $big_ta;
 $Lenght_123 = $block_coins_size->toString();
 echo "\nLenght1:" . $Lenght_123;
 $current .= "\nLenght1:" . $Lenght_123;
 $big_ta_123 = $too_bigg->toString();
 echo "\nLenght2:" . $big_ta_123;
 $current .= "\nLenght2:" . $big_ta_123;
 $current .= "\nLenght:" . $Lenght;
 if ($Lenght > 20 && strpos($Lenght_123, '-') === false) {
     $block_coins_size = $standart_block_size;
     echo "\nBlocksize normal _FIXXX _LENGHT " . $block_coins_size->toString();
     $current .= "\nBlocksize normal _FIXXX _LENGHT " . $block_coins_size->toString();
 }
 $nullNumber = new Math_BigInteger('0');
开发者ID:cpplover,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例4: die

echo "\nGas:" . $gasprice;
echo "\n\n";
$mysqli = mysqli_connect($config['host'], $config['username'], $config['password'], $config['bdd']) or die("Database Error");
$existQuery = "SELECT address,balance FROM miners WHERE balance!='0'";
$existResult = mysqli_query($mysqli, $existQuery) or die("Database Error");
$total = new Math_BigInteger(0);
while ($row = mysqli_fetch_row($existResult)) {
    $payer_adr = $row[0];
    $balanceforthisaddr = new Math_BigInteger($row[1]);
    $ether = floatval($balanceforthisaddr->toString()) / $ether_wei;
    echo "\n" . $payer_adr;
    echo "\nBalance: " . $balanceforthisaddr . ' wei';
    echo "\nBalance: " . $ether . ' Ether';
    echo "\n-------------------------------------------";
    $total = $total->add($balanceforthisaddr);
}
echo "\n\nBalance1:" . $balanceaddr->toString();
echo "\nBalance2:" . $total->toString() . "\n\n";
$ether1 = floatval($balanceaddr->toString()) / $ether_wei;
$ether2 = floatval($total->toString()) / $ether_wei;
echo "\n\nBalance1:" . $ether1;
echo "\nBalance2:" . $ether2;
$block_coins_size = $balanceaddr->subtract($total);
$ethedssr1 = floatval($block_coins_size->toString()) / $ether_wei;
echo "\n\nBalance1:" . $block_coins_size->toString();
echo "\nBalance2:" . $ethedssr1;
if ($balanceaddr > $total) {
    echo "\nCorrect - balance valid\n\n";
} else {
    echo "\n!!! Incorrect - balance invalid !!!\n\n";
}
开发者ID:utocat,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例5: floatval

     $balanceaddr = new Math_BigInteger($escapeDot[0]);
 } else {
     $block_info_last = json_decode($result3, true);
     $balanceaddr = new Math_BigInteger($block_info_last['result']);
 }
 $ether_wei = 1000000000000000000;
 $ether = floatval($balanceaddr->toString()) / $ether_wei;
 $db_users_count = 0;
 $users_data = '';
 $existQuery = "SELECT address,balance FROM miners";
 $existResult = mysqli_query($mysqli, $existQuery) or die("Database Error");
 while ($row = mysqli_fetch_row($existResult)) {
     $val1 = $row[0];
     $val2 = $row[1];
     $newnew_balance = new Math_BigInteger($val2);
     $ether_user = floatval($newnew_balance->toString()) / $ether_wei;
     $users_data = $users_data . ' ' . "('{$val1}', '{$ether_user}', '{$cur_time}'),";
     $db_users_count++;
 }
 $users_data = substr($users_data, 0, -1);
 $add2Stats = "INSERT INTO miner_balance (miner, value, var_timestamp) VALUES" . $users_data;
 $querydone = mysqli_query($mysqli, $add2Stats) or die('erros miner_balance');
 $add2Stats = "INSERT INTO pool_hashrate (hashrate, val_timestamp) VALUES ('{$hashrate_real}', '{$cur_time}')";
 $querydone = mysqli_query($mysqli, $add2Stats) or die("Database Error 0");
 $add2Stats = "INSERT INTO pool_balance (value, var_timestamp) VALUES ('{$ether}', '{$cur_time}')";
 $querydone = mysqli_query($mysqli, $add2Stats) or die("Database Error 0");
 $add2Stats = "INSERT INTO pool_miners (value, var_timestamp) VALUES ('{$count_active}', '{$cur_time}')";
 $querydone = mysqli_query($mysqli, $add2Stats) or die("Database Error 0");
 $add2Stats = "INSERT INTO pool_workers (value, var_timestamp) VALUES ('{$workers_count}', '{$cur_time}')";
 $querydone = mysqli_query($mysqli, $add2Stats) or die("Database Error 0");
 $end_time = time();
开发者ID:utocat,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例6: extractFiles

 private function extractFiles($destinationPath)
 {
     $zero = new Math_BigInteger(0);
     $blockSize = new Math_BigInteger(self::CHUNK_SIZE);
     $inflate = sgfun('zlib.inflate');
     fseek($this->fileHandle, 0, SEEK_SET);
     $i = 0;
     $getNewOffset = true;
     $offsetAvailable = true;
     $offset = null;
     $fp = null;
     foreach ($this->cdr as $row) {
         $path = $destinationPath . $row[0];
         if (!is_writable(dirname($path))) {
             $this->delegate->didFindExtractError('Destination path is not writable: ' . dirname($path));
         }
         $zlen = $row[1];
         $rl = self::CHUNK_SIZE;
         if ($zlen->compare(new Math_BigInteger($rl)) <= 0) {
             $rl = (int) $zlen->toString();
         }
         if ($offsetAvailable && $offset && $offset->compare(new Math_BigInteger($rl)) <= 0) {
             $rl = (int) $offset->toString();
             $data = $this->read($rl);
             $data = $inflate($data) . $inflate();
             if (is_resource($fp) && strlen($data)) {
                 fwrite($fp, $data);
                 fflush($fp);
             }
             $inflate = sgfun('zlib.inflate');
             $getNewOffset = true;
         }
         $fp = @fopen($path, 'wb');
         while ($zlen->compare($zero) > 0) {
             if ($getNewOffset && $offsetAvailable) {
                 $offsetAvailable = isset($this->zoffsets[$i]);
                 if ($offsetAvailable) {
                     $offset = $this->zoffsets[$i];
                     $offset = new Math_BigInteger($offset);
                     $i++;
                 }
             }
             $readlen = self::CHUNK_SIZE;
             $close = false;
             $getNewOffset = false;
             if ($zlen->compare(new Math_BigInteger($readlen)) <= 0) {
                 $readlen = (int) $zlen->toString();
                 $close = true;
             }
             if ($offsetAvailable && $offset->compare(new Math_BigInteger($readlen)) <= 0) {
                 $readlen = (int) $offset->toString();
                 $close = true;
                 $getNewOffset = true;
             }
             if ($readlen) {
                 $data = $this->read($readlen);
                 $data = $inflate($data);
                 if (is_resource($fp)) {
                     fwrite($fp, $data);
                     fflush($fp);
                 }
             }
             if ($close) {
                 $data = $inflate();
                 if (is_resource($fp)) {
                     fwrite($fp, $data);
                     fflush($fp);
                 }
                 $inflate = sgfun('zlib.inflate');
             }
             $zlen = $zlen->subtract(new Math_BigInteger($readlen));
             if ($offsetAvailable) {
                 $offset = $offset->subtract(new Math_BigInteger($readlen));
             }
         }
         if (is_resource($fp)) {
             fclose($fp);
         }
         $this->delegate->didExtractFile($path);
     }
     fclose($this->fileHandle);
 }
开发者ID:Finzy,项目名称:stageDB,代码行数:82,代码来源:SGArchive.php

示例7: round

    $miner_rig = $m->get($miner_reference);
    if (!$miner_rig) {
        $miner_rig = 'rig';
    }
    echo '<tr><td><a href="http://ethereumpool.co/stats/miner/worker/?address=' . $miner . '&worker=' . $newMiners[$i][0] . '">Worker ID:<b>' . $newMiners[$i][0] . '-' . $miner_rig . '</b></a><br>Real hashrate: ' . round($newMiners[$i][1]) . ' hash/s  -> </b>' . $mhash_rl . ' MHASH/s';
    echo '</td></tr>';
}
//totalInvalidShares
$existQuery = "SELECT balance,time,txid,fee FROM payout_history WHERE address='{$miner}' ORDER BY id DESC LIMIT 50;";
$existResult = mysqli_query($mysqli, $existQuery) or die("Database Error");
echo '<table border="1" style="width:100%">';
$r = 0;
$count_r = mysqli_num_rows($existResult);
while ($row = mysqli_fetch_row($existResult)) {
    $balanceforPayment = new Math_BigInteger($row[0]);
    $etherforPayment = floatval($balanceforPayment->toString()) / $ether_wei;
    $r++;
    if ($r == $count_r) {
        echo '<b><br>Last 50 Payments</b><tr><td>' . $balanceforPayment->toString() . ' wei<br>' . $etherforPayment . ' ether<br>When: ' . gmdate("Y-M-d  h:i:s", $row[1]) . '<br>Ethereum network fee deduced:' . $row[3] . '<br>TXID:<a href="http://etherscan.io/tx/' . $row[2] . '" target="_blank">' . $row[2] . '</a>';
    } else {
        echo '<tr><td>' . $balanceforPayment->toString() . ' wei<br>' . $etherforPayment . ' ether<br>When: ' . gmdate("Y-M-d  h:i:s", $row[1]) . '<br>Ethereum network fee deduced:' . $row[3] . '<br>TXID:<a href="http://etherscan.io/tx/' . $row[2] . '" target="_blank">' . $row[2] . '</a>';
    }
    echo '</td></tr>';
}
echo '</table>             <br><br>
                        </div><!--//row-->
                    </div>
                </div><!--//row-->
                <div id="form-messages"></div>
            </form><!--//contact-form-->
        </div><!--//container-->
开发者ID:cpplover,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例8: array

    $data = array("jsonrpc" => "2.0", "method" => "eth_getBalance", "params" => [$addrr[0], 'latest'], "id" => 1);
    $data_string = json_encode($data);
    $ch1 = curl_init('http://127.0.0.1:8983');
    curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
    $result3 = curl_exec($ch1);
    $block_info_last = json_decode($result3, true);
    $escapeDot = explode('.', sprintf('%f', hexdec($block_info_last['result'])));
    $balanceaddr = new Math_BigInteger($escapeDot[0]);
} else {
    $block_info_last = json_decode($result3, true);
    $balanceaddr = new Math_BigInteger($block_info_last['result']);
}
$ether = floatval($balanceaddr->toString()) / $ether_wei;
$data = array("jsonrpc" => "2.0", "method" => "eth_getBlockByNumber", "params" => ["latest", true], "id" => "1");
$data_string = json_encode($data);
$ch1 = curl_init('http://127.0.0.1:8983');
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
$result1 = curl_exec($ch1);
$block_info_last = json_decode($result1, true);
$block_info_lasdsdst = $block_info_last['result'];
$blockstamp = hexdec($block_info_lasdsdst['timestamp']);
$data = array("jsonrpc" => "2.0", "method" => "eth_getBalance", "params" => [$block_info_last['miner'], 'latest'], "id" => 1);
$data_string = json_encode($data);
$ch1 = curl_init('http://127.0.0.1:8983');
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
开发者ID:utocat,项目名称:Ethereumpool.co---Ethereum-Mining-Pool-Full-Source,代码行数:31,代码来源:index.php

示例9:

 /**
  * Transforms binary representation of large integer into its native form.
  *
  * Example of transformation:
  *    $str = "\x12\x34\x56\x78\x90";
  *    $num = 0x9078563412;
  *
  * @param string $str
  * @return gmp resource
  * @access public
  */
 function bin2int($str)
 {
     $bi = new Math_BigInteger(_byte_strrev($str), 256);
     return $bi->toString();
     //return bi_unserialize($str);
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:17,代码来源:Math_BigInteger.php

示例10: bin2hex

<?php

require "rsa.php";
require "BigInteger.php";
$text = "hi man";
$public = 65537;
$modulus = "D192471B8699640F931FE6F4FACC3E990B894F894CEA5BEE0DCBD7A4B76752F7345CF9B5F1271001B724F7A0ABF0A6E911E309536F4BE4749E92DCC531B8E36B95969D206649C9DD2371B413A8DFD9B92569660B1499A5CD310B86A8FDE24988E456897A416D2E7B0B649F0714F322C57EF92563B21A448D1072FF3806C34C75";
$keylength = 1024;
$modulus_16 = new Math_BigInteger($modulus, 16);
$mend = $modulus_16->toString();
echo "now we are going to eccrypt ' {$text} '\n";
$encrypted = rsa_encrypt($text, $public, $mend, $keylength);
echo bin2hex($encrypted);
echo "\n";
echo "now wo are going to decrypt it";
$decrypted = rsa_decrypt();
开发者ID:dalinhuang,项目名称:shopexts,代码行数:16,代码来源:simple.php


注:本文中的Math_BigInteger::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。