本文整理汇总了PHP中hex2dec函数的典型用法代码示例。如果您正苦于以下问题:PHP hex2dec函数的具体用法?PHP hex2dec怎么用?PHP hex2dec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hex2dec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OpenTag
function OpenTag($tag, $attr)
{
//Opening tag
switch ($tag) {
case 'SUP':
if (!empty($attr['SUP'])) {
//Set current font to 6pt
$this->SetFont('', '', 6);
//Start 125cm plus width of cell to the right of left margin
//Superscript "1"
$this->Cell(2, 2, $attr['SUP'], 0, 0, 'L');
}
break;
case 'TABLE':
// TABLE-BEGIN
if (!empty($attr['BORDER'])) {
$this->tableborder = $attr['BORDER'];
} else {
$this->tableborder = 0;
}
break;
case 'TR':
//TR-BEGIN
break;
case 'TD':
// TD-BEGIN
if (!empty($attr['WIDTH'])) {
$this->tdwidth = $attr['WIDTH'] / 4;
} else {
$this->tdwidth = 40;
}
// Set to your own width if you need bigger fixed cells
if (!empty($attr['HEIGHT'])) {
$this->tdheight = $attr['HEIGHT'] / 6;
} else {
$this->tdheight = 6;
}
// Set to your own height if you need bigger fixed cells
if (!empty($attr['ALIGN'])) {
$align = $attr['ALIGN'];
if ($align == 'LEFT') {
$this->tdalign = 'L';
}
if ($align == 'CENTER') {
$this->tdalign = 'C';
}
if ($align == 'RIGHT') {
$this->tdalign = 'R';
}
} else {
$this->tdalign = 'L';
}
// Set to your own
if (!empty($attr['BGCOLOR'])) {
$coul = hex2dec($attr['BGCOLOR']);
$this->SetFillColor($coul['R'], $coul['G'], $coul['B']);
$this->tdbgcolor = true;
}
$this->tdbegin = true;
break;
case 'HR':
if (!empty($attr['WIDTH'])) {
$Width = $attr['WIDTH'];
} else {
$Width = $this->w - $this->lMargin - $this->rMargin;
}
$x = $this->GetX();
$y = $this->GetY();
$this->SetLineWidth(0.2);
$this->Line($x, $y, $x + $Width, $y);
$this->SetLineWidth(0.2);
$this->Ln(1);
break;
case 'STRONG':
$this->SetStyle('B', true);
break;
case 'EM':
$this->SetStyle('I', true);
break;
case 'B':
case 'I':
case 'U':
$this->SetStyle($tag, true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'IMG':
if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) {
if (!isset($attr['WIDTH'])) {
$attr['WIDTH'] = 0;
}
if (!isset($attr['HEIGHT'])) {
$attr['HEIGHT'] = 0;
}
$this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT']));
}
break;
case 'BLOCKQUOTE':
case 'BR':
//.........这里部分代码省略.........
示例2: editTag
function editTag($e_ids, $a, $r)
{
logMe("editTag()\n");
foreach ($e_ids as $i => $e_id) {
$e_ids[$i] = hex2dec(basename($e_id));
//Strip prefix 'tag:google.com,2005:reader/item/'
}
$entryDAO = FreshRSS_Factory::createEntryDao();
switch ($a) {
case 'user/-/state/com.google/read':
$entryDAO->markRead($e_ids, true);
break;
case 'user/-/state/com.google/starred':
$entryDAO->markFavorite($e_ids, true);
break;
/*case 'user/-/state/com.google/tracking-kept-unread':
break;
case 'user/-/state/com.google/like':
break;
case 'user/-/state/com.google/broadcast':
break;*/
}
switch ($r) {
case 'user/-/state/com.google/read':
$entryDAO->markRead($e_ids, false);
break;
case 'user/-/state/com.google/starred':
$entryDAO->markFavorite($e_ids, false);
break;
}
echo 'OK';
exit;
}
示例3: OpenTag
function OpenTag($tag, $attr)
{
// Opening tag
switch ($tag) {
case 'STRONG':
$this->SetStyle('B', true);
break;
case 'EM':
$this->SetStyle('I', true);
break;
case 'UL':
break;
case 'LI':
$this->SetFont('Arial', '', 9);
$this->Ln(1);
$this->Write(4, "o ");
$this->SetLeftMargin($this->lMargin + 5);
break;
case 'B':
case 'I':
case 'U':
$this->SetStyle($tag, true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'IMG':
if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) {
if (!isset($attr['WIDTH'])) {
$attr['WIDTH'] = 0;
}
if (!isset($attr['HEIGHT'])) {
$attr['HEIGHT'] = 0;
}
$this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT']));
}
break;
case 'TR':
case 'BLOCKQUOTE':
case 'BR':
$this->Ln(5);
break;
case 'H1':
$this->Ln(5);
$this->SetFont('Arial', 'B', 20);
break;
case 'H2':
$this->Ln(5);
$this->SetFont('Arial', 'B', 18);
break;
case 'H3':
$this->Ln(5);
$this->SetFont('Arial', 'B', 16);
break;
case 'H4':
$this->Ln(5);
$this->SetFont('Arial', 'B', 14);
break;
case 'H5':
$this->Ln(5);
$this->SetFont('Arial', 'B', 12);
break;
case 'H6':
$this->Ln(5);
$this->SetFont('Arial', 'B', 10);
break;
case 'H7':
$this->Ln(5);
$this->SetFont('Arial', 'B', 9);
break;
case 'P':
$this->SetFont('Arial', '', 9);
$this->Ln(3);
break;
case 'FONT':
if (isset($attr['COLOR']) && $attr['COLOR'] != '') {
$coul = hex2dec($attr['COLOR']);
$this->SetTextColor($coul['R'], $coul['V'], $coul['B']);
$this->issetcolor = true;
}
if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) {
$this->SetFont(strtolower($attr['FACE']));
$this->issetfont = true;
}
break;
}
}
示例4: initialize
public function initialize($username, $userid, $s, $v, $A, $b)
{
$this->_Adec = hex2dec($A);
if (strcmp(bcmod($this->_Adec, $this->_srp->Ndec()), '0') == 0) {
throw new Exception('PROTOCOL_EXCEPTION');
}
$this->_Ahex = $A;
$this->_username = $username;
$this->_userid = $userid;
$this->_shex = $s;
$this->_vhex = $v;
$this->_vdec = hex2dec($v);
$this->_bhex = $b;
$this->_bdec = hex2dec($b);
$this->_computeB();
$this->_computeK();
$this->setValue('SRP_shex', $this->_shex);
$this->setValue('SRP_Ahex', $this->_Ahex);
$this->setValue('SRP_Bhex', $this->_Bhex);
$this->setValue('SRP_Khex', $this->_Khex);
$this->setValue('SRP_I', $this->_username);
$this->setValue('userid', $this->_userid);
$this->_setState(SrpSession::INITIALIZED);
}
示例5: OpenTag
function OpenTag($tag, $attr, $scale)
{
//Opening tag
switch ($tag) {
case 'STRONG':
$this->SetStyle('B', true);
break;
case 'EM':
$this->SetStyle('I', true);
break;
case 'B':
case 'I':
case 'U':
$this->SetStyle($tag, true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'P':
$this->ALIGN = $attr['ALIGN'];
break;
case 'IMG':
$this->IMG = $attr['IMG'];
$this->SRC = $attr['SRC'];
$this->WIDTH = $attr['WIDTH'];
$this->HEIGHT = $attr['HEIGHT'];
$this->PutImage($attr[SRC], $scale);
break;
case 'TR':
case 'BLOCKQUOTE':
case 'BR':
$this->Ln(5);
break;
case 'HR':
if ($attr['WIDTH'] != '') {
$Width = $attr['WIDTH'];
} else {
$Width = $this->w - $this->lMargin - $this->rMargin;
}
$this->Ln(2);
$x = $this->GetX();
$y = $this->GetY();
$this->SetLineWidth(0.4);
$this->Line($x, $y, $x + $Width, $y);
$this->SetLineWidth(0.2);
$this->Ln(2);
break;
case 'FONT':
if (isset($attr['COLOR']) and $attr['COLOR'] != '') {
$coul = hex2dec($attr['COLOR']);
$this->SetTextColor($coul['R'], $coul['G'], $coul['B']);
$this->issetcolor = true;
}
if (isset($attr['FACE']) and in_array(strtolower($attr['FACE']), $this->fontlist)) {
$this->SetFont(strtolower($attr['FACE']));
$this->issetfont = true;
}
break;
}
}
示例6: getSignature
/**
* getSignature
* Get the base64 signature of a dictionary
* @param array Associative array (i.e. dictionary) of key-value pairs
* @param string Hexadecimal string of public key
* @param string Hexadecimal string the private key
* @return string Base64 encoded signature
*/
function getSignature($dict, $key, $privKey)
{
// Sort keys alphabetically
uksort($dict, "strcasecmp");
// Concatenate all values
$total = '';
foreach ($dict as $value) {
$total .= $value;
}
// Escape apostrophes by un-quoting, adding apos, then re-quoting
// so this turns ' into '\'' ... we have to double-slash for this php.
$fixedApostrophes = str_replace("'", "'\\''", $total);
// This part is the most expensive below
// We try to do it with native code first
ob_start();
$passthruString = DOC_ROOT . "/includes/aquaticprime {$key} {$privKey} '{$fixedApostrophes}'";
//passthru($passthruString, $err);
$sig = ob_get_contents();
ob_end_clean();
if (true) {
// Get the hash
$hash = sha1(utf8_encode($total));
// OpenSSL-compatible PKCS1 Padding
// 128 bytes - 20 bytes hash - 3 bytes extra padding = 105 bytes '0xff'
$paddedHash = '0001';
for ($i = 0; $i < 105; $i++) {
$paddedHash .= 'ff';
}
$paddedHash .= '00' . $hash;
$decryptedSig = hex2dec($paddedHash);
// Encrypt into a signature
$sig = powmod($decryptedSig, hex2dec($privKey), hex2dec($key));
$sig = base64_encode(hex2bin(dec2hex($sig)));
}
return $sig;
}
示例7: getSignature
/**
* getSignature
* Get the base64 signature of a dictionary
* @param array Associative array (i.e. dictionary) of key-value pairs
* @param string Hexadecimal string of public key
* @param string Hexadecimal string the private key
* @return string Base64 encoded signature
*/
function getSignature($dict, $key, $privKey)
{
// Sort keys alphabetically
uksort($dict, "strcasecmp");
// Concatenate all values
$total = '';
foreach ($dict as $value) {
$total .= $value;
}
// Escape apostrophes by un-quoting, adding apos, then re-quoting
// so this turns ' into '\'' ... we have to double-slash for this php.
// Switch to UTF8 before otherwise escapeshellarg will strip out non-ASCII characters
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, "en_US.UTF-8");
$fixedApostrophes = escapeshellarg($total);
// restore localte
setlocale(LC_CTYPE, $oldlocale);
// This part is the most expensive below
// We try to do it with native code first
$aquatic_root = preg_replace('!((/[A-Za-z._-]+)+)/AquaticPrime\\.php!', '$1', __FILE__);
ob_start();
$passthruString = $aquatic_root . "/aquaticprime {$key} {$privKey} {$fixedApostrophes}";
passthru($passthruString, $err);
$sig = ob_get_contents();
ob_end_clean();
if ($err) {
error_log("passthrough yielded {$err}: {$passthruString}");
}
// If that fails, do it in php
if ($sig != "") {
$sig = base64_encode($sig);
} else {
// Get the hash
$hash = sha1(utf8_encode($total));
// OpenSSL-compatible PKCS1 Padding
// 128 bytes - 20 bytes hash - 3 bytes extra padding = 105 bytes '0xff'
$paddedHash = '0001';
for ($i = 0; $i < 105; $i++) {
$paddedHash .= 'ff';
}
$paddedHash .= '00' . $hash;
$decryptedSig = hex2dec($paddedHash);
// Encrypt into a signature
$sig = powmod($decryptedSig, hex2dec($privKey), hex2dec($key));
$sig = base64_encode(ap_hex2bin(dec2hex($sig)));
}
return $sig;
}
示例8: OpenTag
function OpenTag($tag, $attr)
{
//Opening tag
switch ($tag) {
case 'STRONG':
$this->SetStyle('B', true);
break;
case 'EM':
$this->SetStyle('I', true);
break;
case 'B':
case 'I':
case 'U':
$this->SetStyle($tag, true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'IMG':
if (isset($attr['SRC']) and (isset($attr['WIDTH']) or isset($attr['HEIGHT']))) {
if (!isset($attr['WIDTH'])) {
$attr['WIDTH'] = 0;
}
if (!isset($attr['HEIGHT'])) {
$attr['HEIGHT'] = 0;
}
$this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT']));
}
break;
case 'TR':
case 'BLOCKQUOTE':
case 'BR':
$this->Ln(5);
break;
case 'P':
$this->Ln(10);
break;
case 'FONT':
if (isset($attr['COLOR']) and $attr['COLOR'] != '') {
$coul = hex2dec($attr['COLOR']);
$this->SetTextColor($coul['R'], $coul['G'], $coul['B']);
$this->issetcolor = true;
}
if (isset($attr['FACE']) and in_array(strtolower($attr['FACE']), $this->fontlist)) {
$this->SetFont(strtolower($attr['FACE']));
$this->issetfont = true;
}
break;
case 'HR':
if (isset($attr['WIDTH']) && $attr['WIDTH'] != '') {
$Width = $attr['WIDTH'];
} else {
$Width = $this->w - $this->lMargin - $this->rMargin;
}
$x = $this->GetX();
$y = $this->GetY();
$this->SetDrawColor(200, 200, 200);
$this->SetLineWidth(0.5);
$this->Line($x + 5, $y + 5, $x + $Width, $y + 5);
$this->SetDrawColor(0, 0, 0);
$this->Ln(8);
break;
case 'H2':
$this->SetFont('Arial', 'B', 18);
break;
}
}
示例9: get_global
function get_global($date, $djia, $debug = false)
{
$md5 = md5($date . "-" . $djia);
list($lat, $lon) = str_split($md5, 16);
$latlon = array(hex2dec($lat), hex2dec($lon));
if ($debug) {
echo "<pre>local:\n" . print_r($latlon, true) . "</pre>\n";
}
$latlon[0] = $latlon[0] * 180 - 90;
$latlon[1] = $latlon[1] * 360 - 180;
if ($debug) {
echo "<pre>global:\n" . print_r($latlon, true) . "</pre>\n";
}
return $latlon;
}
示例10: getSignature
/**
* getSignature
* Get the base64 signature of a dictionary
* @param array Associative array (i.e. dictionary) of key-value pairs
* @param string Hexadecimal string of public key
* @param string Hexadecimal string the private key
* @return string Base64 encoded signature
*/
function getSignature($dict, $key, $privKey)
{
// Sort keys alphabetically
uksort($dict, "strcasecmp");
// Concatenate all values
$total = '';
foreach ($dict as $value) {
$total .= $value;
}
// Get the hash
$hash = sha1(utf8_encode($total));
// OpenSSL-compatible PKCS1 Padding
// 128 bytes - 20 bytes hash - 3 bytes extra padding = 105 bytes '0xff'
$paddedHash = '0001';
for ($i = 0; $i < 105; $i++) {
$paddedHash .= 'ff';
}
$paddedHash .= '00' . $hash;
$decryptedSig = hex2dec($paddedHash);
// Encrypt into a signature
$sig = powmod($decryptedSig, hex2dec($privKey), hex2dec($key));
$sig = base64_encode(hex2bin(dec2hex($sig)));
return $sig;
}
示例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;
}
示例12: mac2dec
function mac2dec($mac)
{
$mac = str_replace(':', '', $mac);
$mac = str_replace('-', '', $mac);
$mac = str_replace('.', '', $mac);
return hex2dec(strtoupper($mac));
}
示例13: hexdec
for ($i = 0; $i < $unkn_len - 1; $i++) {
for ($j = $i + 1; $j < $unkn_len; $j++) {
if ($pins[$i] == $pins[$j] || $pins[$i] == $pin) {
continue;
}
$k = (hexdec(substr($unkn[$pins[$i]], 6, 6)) - hexdec(substr($unkn[$pins[$j]], 6, 6))) / ((int) ($pins[$i] / 10) - (int) ($pins[$j] / 10));
if ($k == 0) {
continue;
}
if ($k == (hexdec(substr($bss, 6, 6)) - hexdec(substr($unkn[$pins[$i]], 6, 6))) / ((int) ($pin / 10) - (int) ($pins[$i] / 10))) {
$found = TRUE;
$plus_score = 1.0 / sqrt(abs(hexdec(substr($bss, 6, 6)) - hexdec(substr($bssid, 6, 6))) + 1);
$plus_score += 1.0 / sqrt(abs(hexdec(substr($unkn[$pins[$i]], 6, 6)) - hexdec(substr($bssid, 6, 6))) + 1);
$plus_score += 1.0 / sqrt(abs(hexdec(substr($unkn[$pins[$j]], 6, 6)) - hexdec(substr($bssid, 6, 6))) + 1);
$total_score += $plus_score;
$algos[] = array('generator' => new WpsGenLinear($k, bcsub(hex2dec($bss), bcmul((int) ($pin / 10), $k))), 'score' => $plus_score);
unset($unkn[$pins[$i]]);
unset($unkn[$pins[$j]]);
break 2;
}
}
}
if (!$found) {
$unkn[$pin] = $bss;
}
} else {
$unkn[$pin] = $bss;
}
}
}
}
示例14: OpenTag
/**
* OpenTag
* öffnet einen HTML Tag in der PDF Klasse
* @param string $tag
* @param array $attr
*/
function OpenTag($tag, $attr)
{
//Start Tag
//diverse Anpassungen an Kunden Bedürfnisse
switch ($tag) {
case 'SUP':
if (!empty($attr['SUP'])) {
//Set current font to 6pt
$this->SetFont('', '', 6);
//Start 125cm plus width of cell to the right of left margin
//Superscript "1"
$this->Cell(2, 2, $attr['SUP'], 0, 0, 'L');
}
break;
case 'TABLE':
// TABLE-BEGIN
$this->iTAB++;
$this->iTR = 0;
if (!empty($attr['BORDER'])) {
$this->tableborder = $attr['BORDER'];
} else {
$this->tableborder = 'B';
}
break;
case 'TR':
//TR-BEGIN
$this->iTR++;
$this->iTD = 0;
break;
case 'TH':
case 'TD':
// TD-BEGIN
$this->iTD++;
/*if( !empty($attr['WIDTH']) ) $this->tdwidth=($attr['WIDTH']/4);
else $this->setTDdim( 'WIDTH' );
if( !empty($attr['HEIGHT']) ) $this->tdheight=($attr['HEIGHT']/6);
else $this->setTDdim( 'HEIGHT' );*/
$this->setTDdim('WIDTH');
$this->setTDdim('HEIGHT');
if (!empty($attr['ALIGN'])) {
$align = $attr['ALIGN'];
if ($align == 'LEFT') {
$this->tdalign = 'L';
}
if ($align == 'CENTER') {
$this->tdalign = 'C';
}
if ($align == 'RIGHT') {
$this->tdalign = 'R';
}
} else {
$this->tdalign = 'L';
}
// Set to your own
if (!empty($attr['BGCOLOR'])) {
$coul = hex2dec($attr['BGCOLOR']);
$this->SetFillColor($coul['R'], $coul['G'], $coul['B']);
$this->tdbgcolor = true;
}
$this->tdbegin = true;
break;
case 'HR':
if (!empty($attr['WIDTH'])) {
//$axt=1;
$Width = $attr['WIDTH'];
} else {
$Width = $this->w - $this->lMargin - $this->rMargin;
}
$x = $this->GetX();
$y = $this->GetY();
$this->SetLineWidth(0.2);
$this->Line($x, $y, $x + $Width, $y);
$this->SetLineWidth(0.2);
$this->Ln(1);
break;
case 'STRONG':
$this->SetStyle('B', true);
break;
case 'EM':
$this->SetStyle('I', true);
break;
case 'B':
case 'I':
case 'U':
$this->SetStyle($tag, true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'IMG':
if (isset($attr['SRC'])) {
if (!isset($attr['WIDTH'])) {
if ($this->firstPic == 1) {
$attr['WIDTH'] = 540;
//.........这里部分代码省略.........
示例15: OpenTag
function OpenTag($tag, $attr)
{
//Opening tag
switch ($tag) {
case 'STRONG':
case 'B':
if ($this->bi) {
$this->SetStyle('B', true);
} else {
$this->SetStyle('U', true);
}
break;
case 'H1':
$this->Ln(5);
$this->SetTextColor(150, 0, 0);
$this->SetFontSize(22);
break;
case 'H2':
$this->Ln(5);
$this->SetFontSize(18);
$this->SetStyle('U', true);
break;
case 'H3':
$this->Ln(5);
$this->SetFontSize(16);
$this->SetStyle('U', true);
break;
case 'H4':
$this->Ln(5);
$this->SetTextColor(102, 0, 0);
$this->SetFontSize(14);
if ($this->bi) {
$this->SetStyle('B', true);
}
break;
case 'PRE':
$this->SetFont('Courier', '', 11);
$this->SetFontSize(11);
$this->SetStyle('B', false);
$this->SetStyle('I', false);
$this->PRE = true;
break;
case 'RED':
$this->SetTextColor(255, 0, 0);
break;
case 'BLOCKQUOTE':
$this->mySetTextColor(100, 0, 45);
$this->Ln(3);
break;
case 'BLUE':
$this->SetTextColor(0, 0, 255);
break;
case 'I':
case 'EM':
if ($this->bi) {
$this->SetStyle('I', true);
}
break;
case 'U':
$this->SetStyle('U', true);
break;
case 'A':
$this->HREF = $attr['HREF'];
break;
case 'IMG':
if (isset($attr['SRC']) && (isset($attr['WIDTH']) || isset($attr['HEIGHT']))) {
if (!isset($attr['WIDTH'])) {
$attr['WIDTH'] = 0;
}
if (!isset($attr['HEIGHT'])) {
$attr['HEIGHT'] = 0;
}
$this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT']));
$this->Ln(3);
}
break;
case 'LI':
$this->Ln(2);
$this->SetTextColor(190, 0, 0);
$this->Write(5, ' » ');
$this->mySetTextColor(-1);
break;
case 'TR':
$this->Ln(7);
$this->PutLine();
break;
case 'BR':
$this->Ln(4);
break;
case 'P':
$this->Ln(10);
$this->SetLeftMargin(60);
break;
case 'HR':
$this->PutLine();
break;
case 'FONT':
if (isset($attr['COLOR']) && $attr['COLOR'] != '') {
$coul = hex2dec($attr['COLOR']);
$this->mySetTextColor($coul['R'], $coul['G'], $coul['B']);
//.........这里部分代码省略.........