Math/PrimeField: fix for when garbage collection has wiped data

This commit is contained in:
terrafrost 2023-07-26 21:34:39 -05:00
parent 69325956ce
commit 25a06f0071

View File

@ -312,9 +312,12 @@ class Integer extends Base
*/
public function toBytes()
{
if (isset(static::$modulo[$this->instanceID])) {
$length = static::$modulo[$this->instanceID]->getLengthInBytes();
return str_pad($this->value->toBytes(), $length, "\0", STR_PAD_LEFT);
}
return $this->value->toBytes();
}
/**
* Converts an Integer to a hex string (eg. base-16).