From 2da66fdd243a76cff08269c8a42ff634fd67a597 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Fri, 4 Dec 2009 19:12:18 +0000 Subject: [PATCH] - toBits() didn't limit the size of the output when the precision was set git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@64 21d32557-59b3-4da0-833f-c5933fad653e --- phpseclib/Math/BigInteger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index 0cfff5f6..925f142c 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -69,7 +69,7 @@ * @author Jim Wigginton * @copyright MMVI Jim Wigginton * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: BigInteger.php,v 1.17 2009-12-03 08:18:53 terrafrost Exp $ + * @version $Id: BigInteger.php,v 1.18 2009-12-04 19:12:18 terrafrost Exp $ * @link http://pear.php.net/package/Math_BigInteger */ @@ -565,7 +565,7 @@ class Math_BigInteger { for ($i = 0; $i < strlen($hex); $i+=8) { $bits.= str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT); } - return $this->precision > 0 ? $bits : ltrim($bits, '0'); + return $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); } /**