mirror of
https://github.com/danog/PrimeModule.git
synced 2024-11-30 04:39:09 +01:00
Fixes
This commit is contained in:
parent
2cb6f19283
commit
b82d23143e
@ -37,15 +37,15 @@ class Struct
|
||||
* Packs data into bytes
|
||||
*
|
||||
* @param $format Format string
|
||||
* @param ...$data Parameters to encode
|
||||
* @param $data Parameters to encode
|
||||
*
|
||||
* @return Encoded data
|
||||
*/
|
||||
public static function pack($format, ...$data)
|
||||
public static function pack($format, $data)
|
||||
{
|
||||
self::constructor();
|
||||
|
||||
return self::$struct->pack($format, ...$data);
|
||||
return self::$struct->pack($format, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,11 +38,11 @@ class StructClass
|
||||
*
|
||||
* Packs data into bytes
|
||||
*
|
||||
* @param ...$data Parameters to encode (may contain format string)
|
||||
* @param $data Parameters to encode (may contain format string)
|
||||
*
|
||||
* @return Encoded data
|
||||
*/
|
||||
public function pack(...$data)
|
||||
public function pack($data)
|
||||
{
|
||||
if ($this->format === null) {
|
||||
$format = array_shift($data);
|
||||
@ -50,7 +50,7 @@ class StructClass
|
||||
$format = $this->format;
|
||||
}
|
||||
|
||||
return $this->struct->pack($format, ...$data);
|
||||
return $this->struct->pack($format, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,12 +249,13 @@ class StructTools
|
||||
* Packs data into bytes
|
||||
*
|
||||
* @param $format Format string
|
||||
* @param ...$data Parameters to encode
|
||||
* @param $data Parameters to encode
|
||||
*
|
||||
* @return Encoded data
|
||||
*/
|
||||
public function pack($format, ...$data)
|
||||
public function pack($format, $data)
|
||||
{
|
||||
$data = [$data];
|
||||
$format = $this->padformat($format);
|
||||
$result = null; // Data to return
|
||||
$size = $this->calcsize($format);
|
||||
|
@ -80,7 +80,7 @@ function random_string($length)
|
||||
}
|
||||
function gen_payload()
|
||||
{
|
||||
return \danog\PHP\Struct::pack('<Bqqii', 10, 0, (int) (time() << 32), 20, 1615239032).random_string(16);
|
||||
return chr(10).str_repeat(chr(0), 8).\danog\PHP\Struct::pack('<q', (int) (time() << 32)).pack('VV', 20, 1615239032).random_string(16);
|
||||
}
|
||||
|
||||
echo PHP_EOL.'----------- HUGE SEMIPRIME TESTS (100 semiprimes) ----------'.PHP_EOL;
|
||||
|
Loading…
Reference in New Issue
Block a user