summaryrefslogtreecommitdiff
path: root/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php')
-rw-r--r--vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php b/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
new file mode 100644
index 0000000..3c959e9
--- /dev/null
+++ b/vendor/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Finite Field Integer Base Class
+ *
+ * PHP version 5 and 7
+ *
+ * @author Jim Wigginton <[email protected]>
+ * @copyright 2017 Jim Wigginton
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
+ */
+
+namespace phpseclib3\Math\Common\FiniteField;
+
+/**
+ * Finite Field Integer
+ *
+ * @author Jim Wigginton <[email protected]>
+ */
+abstract class Integer implements \JsonSerializable
+{
+ /**
+ * JSON Serialize
+ *
+ * Will be called, automatically, when json_encode() is called on a BigInteger object.
+ *
+ * PHP Serialize isn't supported because unserializing would require the factory be
+ * serialized as well and that just sounds like too much
+ *
+ * @return array{hex: string}
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ['hex' => $this->toHex(true)];
+ }
+
+ /**
+ * Converts an Integer to a hex string (eg. base-16).
+ *
+ * @return string
+ */
+ abstract public function toHex();
+}