Diff: STRATO-apps/wordpress_03/app/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 +
3 + if (class_exists('ParagonIE_Sodium_Core_Curve25519_Fe', false)) {
4 + return;
5 + }
6 +
7 + /**
8 + * Class ParagonIE_Sodium_Core_Curve25519_Fe
9 + *
10 + * This represents a Field Element
11 + */
12 + class ParagonIE_Sodium_Core_Curve25519_Fe implements ArrayAccess
13 + {
14 + /**
15 + * @var int
16 + */
17 + public $e0 = 0;
18 +
19 + /**
20 + * @var int
21 + */
22 + public $e1 = 0;
23 +
24 + /**
25 + * @var int
26 + */
27 + public $e2 = 0;
28 +
29 + /**
30 + * @var int
31 + */
32 + public $e3 = 0;
33 +
34 + /**
35 + * @var int
36 + */
37 + public $e4 = 0;
38 +
39 + /**
40 + * @var int
41 + */
42 + public $e5 = 0;
43 +
44 + /**
45 + * @var int
46 + */
47 + public $e6 = 0;
48 +
49 + /**
50 + * @var int
51 + */
52 + public $e7 = 0;
53 +
54 + /**
55 + * @var int
56 + */
57 + public $e8 = 0;
58 +
59 + /**
60 + * @var int
61 + */
62 + public $e9 = 0;
63 +
64 + /**
65 + * @param int $e0
66 + * @param int $e1
67 + * @param int $e2
68 + * @param int $e3
69 + * @param int $e4
70 + * @param int $e5
71 + * @param int $e6
72 + * @param int $e7
73 + * @param int $e8
74 + * @param int $e9
75 + */
76 + public function __construct(
77 + $e0 = 0,
78 + $e1 = 0,
79 + $e2 = 0,
80 + $e3 = 0,
81 + $e4 = 0,
82 + $e5 = 0,
83 + $e6 = 0,
84 + $e7 = 0,
85 + $e8 = 0,
86 + $e9 = 0
87 + ) {
88 + $this->e0 = $e0;
89 + $this->e1 = $e1;
90 + $this->e2 = $e2;
91 + $this->e3 = $e3;
92 + $this->e4 = $e4;
93 + $this->e5 = $e5;
94 + $this->e6 = $e6;
95 + $this->e7 = $e7;
96 + $this->e8 = $e8;
97 + $this->e9 = $e9;
98 + }
99 +
100 + /**
101 + * @internal You should not use this directly from another application
102 + *
103 + * @param array $array
104 + * @return self
105 + */
106 + public static function fromArray($array)
107 + {
108 + $obj = new ParagonIE_Sodium_Core_Curve25519_Fe();
109 + $obj->e0 = isset($array[0]) ? (int) $array[0] : 0;
110 + $obj->e1 = isset($array[1]) ? (int) $array[1] : 0;
111 + $obj->e2 = isset($array[2]) ? (int) $array[2] : 0;
112 + $obj->e3 = isset($array[3]) ? (int) $array[3] : 0;
113 + $obj->e4 = isset($array[4]) ? (int) $array[4] : 0;
114 + $obj->e5 = isset($array[5]) ? (int) $array[5] : 0;
115 + $obj->e6 = isset($array[6]) ? (int) $array[6] : 0;
116 + $obj->e7 = isset($array[7]) ? (int) $array[7] : 0;
117 + $obj->e8 = isset($array[8]) ? (int) $array[8] : 0;
118 + $obj->e9 = isset($array[9]) ? (int) $array[9] : 0;
119 + return $obj;
120 + }
121 +
122 + /**
123 + * @internal You should not use this directly from another application
124 + *
125 + * @param int|null $offset
126 + * @param int $value
127 + * @return void
128 + */
129 + #[ReturnTypeWillChange]
130 + public function offsetSet($offset, $value)
131 + {
132 + if (!is_int($value)) {
133 + throw new InvalidArgumentException('Expected an integer');
134 + }
135 + switch ($offset) {
136 + case 0:
137 + $this->e0 = $value;
138 + break;
139 + case 1:
140 + $this->e1 = $value;
141 + break;
142 + case 2:
143 + $this->e2 = $value;
144 + break;
145 + case 3:
146 + $this->e3 = $value;
147 + break;
148 + case 4:
149 + $this->e4 = $value;
150 + break;
151 + case 5:
152 + $this->e5 = $value;
153 + break;
154 + case 6:
155 + $this->e6 = $value;
156 + break;
157 + case 7:
158 + $this->e7 = $value;
159 + break;
160 + case 8:
161 + $this->e8 = $value;
162 + break;
163 + case 9:
164 + $this->e9 = $value;
165 + break;
166 + default:
167 + throw new OutOfBoundsException('Index out of bounds');
168 + }
169 + }
170 +
171 + /**
172 + * @internal You should not use this directly from another application
173 + *
174 + * @param int $offset
175 + * @return bool
176 + */
177 + #[ReturnTypeWillChange]
178 + public function offsetExists($offset)
179 + {
180 + return $offset >= 0 && $offset < 10;
181 + }
182 +
183 + /**
184 + * @internal You should not use this directly from another application
185 + *
186 + * @param int $offset
187 + * @return void
188 + */
189 + #[ReturnTypeWillChange]
190 + public function offsetUnset($offset)
191 + {
192 + switch ($offset) {
193 + case 0:
194 + $this->e0 = 0;
195 + break;
196 + case 1:
197 + $this->e1 = 0;
198 + break;
199 + case 2:
200 + $this->e2 = 0;
201 + break;
202 + case 3:
203 + $this->e3 = 0;
204 + break;
205 + case 4:
206 + $this->e4 = 0;
207 + break;
208 + case 5:
209 + $this->e5 = 0;
210 + break;
211 + case 6:
212 + $this->e6 = 0;
213 + break;
214 + case 7:
215 + $this->e7 = 0;
216 + break;
217 + case 8:
218 + $this->e8 = 0;
219 + break;
220 + case 9:
221 + $this->e9 = 0;
222 + break;
223 + default:
224 + throw new OutOfBoundsException('Index out of bounds');
225 + }
226 + }
227 +
228 + /**
229 + * @internal You should not use this directly from another application
230 + *
231 + * @param int $offset
232 + * @return int
233 + */
234 + #[ReturnTypeWillChange]
235 + public function offsetGet($offset)
236 + {
237 + switch ($offset) {
238 + case 0:
239 + return (int) $this->e0;
240 + case 1:
241 + return (int) $this->e1;
242 + case 2:
243 + return (int) $this->e2;
244 + case 3:
245 + return (int) $this->e3;
246 + case 4:
247 + return (int) $this->e4;
248 + case 5:
249 + return (int) $this->e5;
250 + case 6:
251 + return (int) $this->e6;
252 + case 7:
253 + return (int) $this->e7;
254 + case 8:
255 + return (int) $this->e8;
256 + case 9:
257 + return (int) $this->e9;
258 + default:
259 + throw new OutOfBoundsException('Index out of bounds');
260 + }
261 + }
262 +
263 + /**
264 + * @internal You should not use this directly from another application
265 + *
266 + * @return array
267 + */
268 + public function __debugInfo()
269 + {
270 + return array(
271 + implode(', ', array(
272 + $this->e0, $this->e1, $this->e2, $this->e3, $this->e4,
273 + $this->e5, $this->e6, $this->e7, $this->e8, $this->e9
274 + ))
275 + );
276 + }
277 + }
278 +