mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-17 02:35:10 +00:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
aac5b0a74c
@ -658,11 +658,11 @@ class BigInteger
|
|||||||
{
|
{
|
||||||
$hex = $this->toHex($twos_compliment);
|
$hex = $this->toHex($twos_compliment);
|
||||||
$bits = '';
|
$bits = '';
|
||||||
for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) {
|
for ($i = strlen($hex) - 6, $start = strlen($hex) % 6; $i >= $start; $i-=6) {
|
||||||
$bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits;
|
$bits = str_pad(decbin(hexdec(substr($hex, $i, 6))), 24, '0', STR_PAD_LEFT) . $bits;
|
||||||
}
|
}
|
||||||
if ($start) { // hexdec('') == 0
|
if ($start) { // hexdec('') == 0
|
||||||
$bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits;
|
$bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8 * $start, '0', STR_PAD_LEFT) . $bits;
|
||||||
}
|
}
|
||||||
$result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
|
$result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user