mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-17 18:55:13 +00:00
- fixed pear.php.net bug # 18015 (thanks, nounours!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@129 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
2c06c81e77
commit
19cc43cc16
@ -67,7 +67,7 @@
|
|||||||
* @author Jim Wigginton <terrafrost@php.net>
|
* @author Jim Wigginton <terrafrost@php.net>
|
||||||
* @copyright MMVI Jim Wigginton
|
* @copyright MMVI Jim Wigginton
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt
|
* @license http://www.gnu.org/licenses/lgpl.txt
|
||||||
* @version $Id: BigInteger.php,v 1.33 2010-03-22 22:32:03 terrafrost Exp $
|
* @version $Id: BigInteger.php,v 1.33 2010/03/22 22:32:03 terrafrost Exp $
|
||||||
* @link http://pear.php.net/package/Math_BigInteger
|
* @link http://pear.php.net/package/Math_BigInteger
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -596,9 +596,10 @@ class Math_BigInteger {
|
|||||||
{
|
{
|
||||||
$hex = $this->toHex($twos_compliment);
|
$hex = $this->toHex($twos_compliment);
|
||||||
$bits = '';
|
$bits = '';
|
||||||
for ($i = 0; $i < strlen($hex); $i+=8) {
|
for ($i = 0, $end = strlen($hex) & 0xFFFFFFF8; $i < $end; $i+=8) {
|
||||||
$bits.= str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT);
|
$bits.= str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
$bits.= str_pad(decbin(hexdec(substr($hex, $end))), strlen($hex) & 7, '0', STR_PAD_LEFT);
|
||||||
return $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
|
return $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user