本文整理汇总了PHP中Math_BigInteger::toBits方法的典型用法代码示例。如果您正苦于以下问题:PHP Math_BigInteger::toBits方法的具体用法?PHP Math_BigInteger::toBits怎么用?PHP Math_BigInteger::toBits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math_BigInteger
的用法示例。
在下文中一共展示了Math_BigInteger::toBits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSize
/**
* Returns the key size
*
* More specifically, this returns the size of the modulo in bits.
*
* @access public
* @return Integer
*/
function getSize()
{
return !isset($this->modulus) ? 0 : strlen($this->modulus->toBits());
}
示例2: while
/**
* RSASSA-PSS-VERIFY
*
* See {@link http://tools.ietf.org/html/rfc3447#section-8.1.2 RFC3447#section-8.1.2}.
*
* @access private
* @param String $m
* @param String $s
* @return String
*/
function _rsassa_pss_verify($m, $s)
{
// Length checking
if (strlen($s) > $this->k) {
user_error('Invalid signature', E_USER_NOTICE);
return false;
}
// add leading zeros if missing added by Pfeffer
while (strlen($s) < $this->k) {
$s = chr(0) . $s;
}
// RSA verification
$tmp = $this->modulus->toBits();
$modBits = strlen($tmp);
// by Pfeffer, has been: 8 * $this->k;
$s2 = $this->_os2ip($s);
$m2 = $this->_rsavp1($s2);
if ($m2 === false) {
user_error('Invalid signature', E_USER_NOTICE);
return false;
}
$tmp = $modBits / 8;
// by pfeffer, has been: $modBits >> 3
$em = $this->_i2osp($m2, ceil($tmp));
if ($em === false) {
user_error('Invalid signature', E_USER_NOTICE);
return false;
}
// EMSA-PSS verification
return $this->_emsa_pss_verify($m, $em, $modBits - 1);
}