mirror of
https://github.com/danog/tgseclib.git
synced 2024-11-27 04:34:45 +01: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>
|
||||
* @copyright MMVI Jim Wigginton
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -596,9 +596,10 @@ class Math_BigInteger {
|
||||
{
|
||||
$hex = $this->toHex($twos_compliment);
|
||||
$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, $end))), strlen($hex) & 7, '0', STR_PAD_LEFT);
|
||||
return $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user