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


PHP strToHex函数代码示例

本文整理汇总了PHP中strToHex函数的典型用法代码示例。如果您正苦于以下问题:PHP strToHex函数的具体用法?PHP strToHex怎么用?PHP strToHex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: BlockIo

/* This example script does the following:

   This script converts a given string into a Private Key for a specific address.
   Useful for extracting Private Keys in Wallet Import Format when using Distributed Trust,
   and mop-py to sweep coins out of the Distributed Trust address without going through Block.io.

   IMPORTANT! Specify your own API Key here.
   The network to use for the Wallet Import Format is determined from the API Key used.

   Contact support@block.io for any help with this.
*/

<?php 
require_once 'path/to/block_io.php';
/* Replace the $apiKey with the API Key from your Block.io Wallet. */
$apiKey = 'YOUR API KEY';
$pin = 'PIN - NOT NEEDED';
$version = 2;
// the API version
$block_io = new BlockIo($apiKey, $pin, $version);
$network = $block_io->get_balance()->data->network;
// get our current network off Block.io
$passphrase = strToHex('alpha1alpha2alpha3alpha4');
$key = $block_io->initKey()->fromPassphrase($passphrase);
echo "Current Network: " . $network . "\n";
echo "Private Key: " . $key->toWif($network) . "\n";
// print out the private key for the given network
开发者ID:rpcarnell,项目名称:block_io-php,代码行数:27,代码来源:keys.php

示例2: StateMsg

function StateMsg($msgs)
{
    $str = explode("", $msgs);
    $ste = 0;
    if (count($str) > 3) {
        switch ($str[0]) {
            case 'success':
                $ste = 1;
                break;
                /*成功返回*/
            /*成功返回*/
            case 'serror':
                $ste = -1;
                break;
                /*错误返回*/
        }
        if (0 != $ste) {
            if (strlen($str[3]) > 1) {
                $mstr = '0x' . strToHex($str[3]);
            } else {
                $mstr = '""';
            }
            $hsql = 'update task_tab set msg=' . $mstr . ",ste={$ste} where id=" . $str[1] . ' and tkey="' . $str[2] . '"';
            if (!HwExec($hsql)) {
                WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']任务状态更新-错误', $hsql);
            }
        } else {
            WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']节点状态码-错误', "未知返回状态:\n" . $str[0]);
        }
    } else {
        WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']节点状态码-', strToHex($msgs));
    }
}
开发者ID:sdgdsffdsfff,项目名称:config_center,代码行数:33,代码来源:set.php

示例3: tokenString

 public static function tokenString($userId, $departmentId, $groupId, $created)
 {
     $tokenString = array();
     $tokenString['userId'] = $userId;
     $tokenString['departmentId'] = $departmentId;
     $tokenString['groupId'] = $groupId;
     $tokenString['created'] = $created;
     return strToHex(\Think\Crypt\Driver\Base64::encrypt(json_encode($tokenString), 'easonchan'));
 }
开发者ID:kunase,项目名称:bbter-all,代码行数:9,代码来源:TokenInfo.class.php

示例4: encrypt

function encrypt($string, $key)
{
    $result = '';
    for ($i = 0; $i < strlen($string); $i++) {
        $char = substr($string, $i, 1);
        $keychar = substr($key, $i % strlen($key) - 1, 1);
        $char = chr(ord($char) + ord($keychar));
        $result .= $char;
    }
    return strToHex($result);
}
开发者ID:allin-wichariy,项目名称:dct,代码行数:11,代码来源:notas1.php

示例5: HwCreateTask

function HwCreateTask($ip, $fid, $ftr)
{
    global $link;
    if (strlen($ip) > 30) {
        return false;
    } else {
        $node = '0x' . strToHex($ip);
    }
    $dte = date('Y-m-d H:i:s');
    $key = md5($ip . Rndkeys(32) . $dte, false);
    $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')";
    if (HwExec($hsql)) {
        echo "successCreate task Success ~!";
        HwSend($ip, '32303', $key);
    } else {
        echo "errorx1Fail to create task ~!";
    }
    return true;
}
开发者ID:sdgdsffdsfff,项目名称:config_center,代码行数:19,代码来源:task.php

示例6: verifyToken

 public static function verifyToken($token)
 {
     $tokenString = hexToStr($token);
     $jsonData = \Think\Crypt\Driver\Base64::decrypt($tokenString, 'easonchan');
     $array = json_decode($jsonData, true);
     if ($array == null) {
         return false;
     }
     $created = $array['created'];
     $expire = BoxTokenHelper::$expire;
     $now = time();
     if ($created + $expire < $now) {
         return false;
     }
     $info = new TokenInfo($array['userId'], $array['departmentId'], $array['groupId'], $array['created']);
     $array['created'] = time();
     $tokenString = strToHex(\Think\Crypt\Driver\Base64::encrypt(json_encode($array), 'easonchan'));
     return array('str' => $tokenString, 'info' => $info);
 }
开发者ID:kunase,项目名称:bbter-all,代码行数:19,代码来源:BoxTokenHelper.class.php

示例7: rcon

function rcon($serverip, $serverport, $rconpassword, $cmd)
{
    $passhead = chr(0xff) . chr(0x0);
    $head = chr(0x42) . chr(0x45);
    $pass = $passhead . $rconpassword;
    $answer = "";
    $checksum = get_checksum($pass);
    $loginmsg = $head . $checksum . $pass;
    $rcon = fsockopen("udp://" . $serverip, $serverport, $errno, $errstr, 1);
    stream_set_timeout($rcon, 5);
    if (!$rcon) {
        echo "ERROR: {$errno} - {$errstr}<br />\n";
    } else {
        fwrite($rcon, $loginmsg);
        $res = fread($rcon, 16);
        $cmdhead = chr(0xff) . chr(0x1) . chr(0x0);
        //$cmd = "Players";
        $cmd = $cmdhead . $cmd;
        $checksum = get_checksum($cmd);
        $cmdmsg = $head . $checksum . $cmd;
        $hlen = strlen($head . $checksum . chr(0xff) . chr(0x1));
        fwrite($rcon, $cmdmsg);
        $answer = fread($rcon, 102400);
        if (strToHex(substr($answer, 9, 1)) == "0") {
            $count = strToHex(substr($answer, 10, 1));
            //echo $count."<br/>";
            for ($i = 0; $i < $count - 1; $i++) {
                $answer .= fread($rcon, 102400);
            }
        }
        //echo strToHex(substr($answer, 0, 16))."<br/>";
        //echo strToHex($answer)."<br/>";
        //echo $answer."<br/>";
        $cmd = "Exit";
        $cmd = $cmdhead . $cmd;
        $checksum = get_checksum($cmd);
        $cmdmsg = $head . $checksum . $cmd;
        fwrite($rcon, $cmdmsg);
    }
    return $answer;
}
开发者ID:nsonP,项目名称:DayZAdmin,代码行数:41,代码来源:rcon.php

示例8: check_video

 public function check_video($videoid)
 {
     $rows = $this->db->get_rows('videos', array(), "LIMIT 1000");
     foreach ($rows as $row) {
         extract($row);
         $fh = fopen($storage, "rb");
         if ($fh) {
             $fheader = fread($fh, 20);
             $fheader_hex = strToHex($fheader);
             $fheader_printable = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $fheader);
             if (in_array($fheader_printable, $this->known_formats)) {
                 $known = "<font color='green'>[recognized]</font>";
             } else {
                 $known = "<font color='red'>[not recognized]</font>";
             }
             $this->msg .= "File {$storage}, request {$request}, header {$fheader_printable}, hex {$fheader_hex} {$known}<br>\n";
             fclose($fh);
         } else {
             $this->msg .= "File {$storage}, request {$request} not found!<br>\n";
         }
     }
 }
开发者ID:laiello,项目名称:yt-cache,代码行数:22,代码来源:videos.php

示例9: HwCreateTask

function HwCreateTask($ip, $fid, $ftr)
{
    global $link;
    if (strlen($ip) > 30) {
        return false;
    } else {
        $node = '0x' . strToHex($ip);
    }
    $dte = date('Y-m-d H:i:s');
    $key = md5($ip . Rndkeys(32) . $dte . microtime(), false);
    $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')";
    if (HwExec($hsql)) {
        if (HwSend($ip, '32303', $key) > -1) {
            echo "success{$key}Create task Success ~!";
        } else {
            WebCenterLogs('[' . $ip . ']推送失败', $hsql);
        }
    } else {
        echo "errorx1{$key}Fail to create task ~!";
        WebCenterLogs('[' . $ip . ']任务创建失败', $hsql);
    }
    return true;
}
开发者ID:sdgdsffdsfff,项目名称:config_center,代码行数:23,代码来源:task.php

示例10: base64_encode

        $objRotatividade->set_hor_entrada($hor_entrada);
        $objRotatividade->set_dat_cadastro($dat_cadastro);
        $objRotatividade->set_cod_rotatividade($cod_rotatividade);
        $objRotatividade->set_hor_saida($hor_saida);
        $objRotatividade->set_dat_saida($dat_saida);
        $objRotatividade->set_cod_desconto($cod_desconto);
        $objRotatividade->set_val_total(str_replace(",", ".", $val_total));
        $objRotatividade->set_val_cobrado(str_replace(",", ".", $val_cobrado));
        $objRotatividade->set_des_justificativa($des_justificativa);
        $objRotatividade->set_tem_permanencia($tem_permanencia);
        $objRotatividade->removeRotatividade($objRotatividade);
        $objClientes->set_des_placa($des_placa);
        $arrCliente = $objClientes->buscaClientes($objClientes);
        $cod_cliente = $arrCliente[0]['cod_cliente'];
        $msgRetorno = 'Veiculo liberado com sucesso';
        $msgRetorno .= '<br> Deseja imprimir RPS? <a href="' . $url . 'rotatividade/index.php?imprimir=' . base64_encode(strToHex('imprimeRPS')) . '&cod_rotatividade=' . $cod_rotatividade . '&cod_cliente=' . $cod_cliente . '">Sim</a>';
        $val_total = "";
    }
}
if (isset($_GET) && !empty($_GET['imprimir'])) {
    $cod_rotatividade = $_GET['cod_rotatividade'];
    $cod_rotatividade = base64_decode(hexToStr($cod_rotatividade));
    $cod_cliente = $_GET['cod_cliente'];
    geraRPS($cod_rotatividade, 1, $cod_cliente);
    Header("Location:" . $url . "rotatividade/index.php");
}
if (isset($_POST) && !empty($_POST['imprimirCupomEntrada']) && $verificaImprimir == true) {
    $imprime_cupom = true;
}
//$hora_entrada = date("H:i:s");
$hora_entrada = "";
开发者ID:blusol,项目名称:flanelasys,代码行数:31,代码来源:index.php

示例11: computverifier

function computverifier($srp, $user, $pwd, $salt)
{
    // private key
    $innerHash = $srp->hashHex(strToHex($user) . '3a' . strToHex($pwd));
    $privateKey = $srp->hashHex($salt . $innerHash);
    // verifier
    $tmp = dec2hex(bcpowmod($srp->gdec(), hex2dec($privateKey), $srp->Ndec()));
    $verifier = str_pad($tmp, strlen($srp->Nhex()), "0", STR_PAD_LEFT);
    return $verifier;
}
开发者ID:nduhamel,项目名称:pwdremind,代码行数:10,代码来源:add_user.php

示例12: ParseData

 /**
  * handle incoming data along capabilities
  * @param array $data
  */
 private function ParseData($data)
 {
     //
     $caps = $this->GetCaps();
     //$this->debug(__FUNCTION__,print_r($this->all_caps,true));
     foreach (array_keys($caps) as $cap) {
         $ident = $caps[$cap];
         $vid = @$this->GetIDForIdent($ident);
         if ($vid == 0) {
             $this->debug(__FUNCTION__, "Cap {$cap} Ident {$ident}: Variable missed");
             continue;
         }
         if (!isset($data[$cap])) {
             continue;
         }
         $s = $data[$cap];
         switch ($cap) {
             //integer
             case 'TS':
                 //Timestamp
             //Timestamp
             case 'Signal':
                 //RSSI
             //RSSI
             case 'Timer':
                 //Duration code
             //Duration code
             case 'Dimmer':
                 //intensity 100%
             //intensity 100%
             case 'Shutter':
                 //intensity 100%
                 $iv = (int) $s;
                 SetValueInteger($vid, $iv);
                 break;
                 //String
             //String
             case 'Name':
                 //Duration code
                 $st = utf8_decode($s);
                 SetValueString($vid, $st);
                 break;
                 //special
             //special
             case 'Switch':
                 //Status
                 $state = $this->SwitchStatus($s);
                 SetValueBoolean($vid, $state);
                 break;
             case 'Lock':
                 //Status
                 $state = preg_match("/YES|CLOSE|OK/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'Alert':
                 //Status
                 $state = !preg_match("/YES|ALERT/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'Battery':
                 //battery
                 $state = !preg_match("/LOW|WARN/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'FS20':
                 //fs20 mode decoding
                 $state = false;
                 $intensity = 0;
                 $timer = 0;
                 $acode = '';
                 $actioncode = '';
                 $code = utf8_decode($s);
                 $this->debug(__FUNCTION__, "FS20 Code " . strToHex($code));
                 $action = $code[0];
                 $ext = ord($code[1]);
                 $tvid = @$this->GetIDForIdent($caps['Timer']);
                 $dvid = @$this->GetIDForIdent($caps['Dimmer']);
                 $swid = @$this->GetIDForIdent($caps['Switch']);
                 $avid = @$this->GetIDForIdent($caps['TimerActionCode']);
                 $this->debug(__FUNCTION__, "FS20 Vars S:{$swid},D:{$dvid},T:{$tvid},A:{$avid}");
                 if ($dvid) {
                     $intensity = GetValueInteger($dvid);
                 }
                 if ($swid) {
                     $state = GetValueBoolean($swid);
                 }
                 if ($tvid) {
                     $timer = GetValueInteger($tvid);
                 }
                 if ($avid) {
                     $acode = GetValueString($avid);
                 }
                 $ac = ord($action) & 0x1f;
//.........这里部分代码省略.........
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:101,代码来源:module.php

示例13: WebCenterLogs

function WebCenterLogs($title, $logbody = '')
{
    global $link;
    $hsql = 'insert into fw_log(jet,log,uid,ip,dte)values';
    if (strlen($title) > 0) {
        $jet = '0x' . strToHex($title);
    } else {
        $jet = '""';
    }
    if (strlen($logbody) > 0) {
        $log = '0x' . strToHex($logbody);
    } else {
        $log = '0x' . strToHex($_SERVER['HTTP_USER_AGENT']);
    }
    $ip = $_SERVER['REMOTE_ADDR'];
    if (isset($_SESSION['#UID'])) {
        $uid = $_SESSION['#UID'];
    } else {
        $uid = '"node"';
    }
    $dte = date('Y-m-d H:i:s');
    $hsql .= "({$jet},{$log},{$uid},'{$ip}','{$dte}')";
    HwExec($hsql);
}
开发者ID:sdgdsffdsfff,项目名称:config_center,代码行数:24,代码来源:hwfunction.php

示例14: str_replace

if (isset($_POST) && !empty($_POST['envia'])) {
    $valor_pago = str_replace(",", ".", $_POST['valor_pago']);
    $periodo_inicial = gravaData($_POST['periodo_inicial']);
    $periodo_final = gravaData($_POST['periodo_final']);
    $data_pagamento = gravaData($_POST['data_pagamento']);
    $cod_cliente = $_POST['cod_cliente'];
    $cod_mensalidade = $_POST['cod_mensalidade'];
    $objMensalidadeUsuario->set_valor_pago($valor_pago);
    $objMensalidadeUsuario->set_periodo_inicial($periodo_inicial);
    $objMensalidadeUsuario->set_periodo_final($periodo_final);
    $objMensalidadeUsuario->set_data_pagamento($data_pagamento);
    $objMensalidadeUsuario->set_cod_cliente($cod_cliente);
    $objMensalidadeUsuario->set_cod_mensalidade($cod_mensalidade);
    $cod_pagamento = $objMensalidadeUsuario->cadastraPagamento();
    $msgRetorno = "Pagamento registrado com sucesso";
    $msgRetorno .= '<br> Deseja imprimir RPS? <a href="' . $url . 'admin/clientes/mensalidade.php?imprimir=' . base64_encode(strToHex('imprimeRPS')) . '&cod_pagamento=' . $cod_pagamento . '">Sim</a>';
    $objMensalidadeUsuario->ResetObject();
}
if (isset($_POST) && !empty($_POST['ImprimirComprovante'])) {
    $cod_mensalidade_usuario = $_POST['cod_mensalidade_usuario'];
    $objMensalidadeUsuario->set_cod_mensalidade_usuario($cod_mensalidade_usuario);
    $objMensalidadeUsuario->geraComprovante();
}
if (isset($_POST) && !empty($_POST['ExcluirPagamento'])) {
    $cod_mensalidade_usuario = $_POST['cod_mensalidade_usuario'];
    $cod_cliente = $_POST['cod_cliente'];
    $objMensalidadeUsuario->set_cod_mensalidade_usuario($cod_mensalidade_usuario);
    $msgRetorno = $objMensalidadeUsuario->excluirPagamento();
}
if (isset($_GET) && !empty($_GET['imprimir'])) {
    $cod_pagamento = $_GET['cod_pagamento'];
开发者ID:blusol,项目名称:flanelasys,代码行数:31,代码来源:mensalidade.php

示例15: Encrypt

function Encrypt($sValue, $sSecretKey)
{
    return strToHex(rtrim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sSecretKey, $sValue, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))), ""));
}
开发者ID:samirios1,项目名称:niter,代码行数:4,代码来源:config.php


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