Completed
Push — develop ( 24c9de...c5d946 )
by Zack
16:00
created
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
28 28
 
29
-		unset( $field_options['search_filter'] );
29
+		unset( $field_options[ 'search_filter' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$add_options['link_to_file'] = array(
35
+		$add_options[ 'link_to_file' ] = array(
36 36
 			'type' => 'checkbox',
37 37
 			'label' => __( 'Display as a Link:', 'gravityview' ),
38
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
38
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
39 39
 			'value' => false,
40 40
 			'merge_tags' => false,
41 41
 		);
42 42
 
43
-		$add_options['image_width'] = array(
43
+		$add_options[ 'image_width' ] = array(
44 44
 			'type' => 'text',
45 45
 			'label' => __( 'Custom Width:', 'gravityview' ),
46 46
 			'desc' => __( 'Override the default image width (250).', 'gravityview' ),
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 			$base_id = null;
159 159
 
160 160
 			$is_single = gravityview_get_context() === 'single';
161
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
161
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
162 162
 			$field_compat = $gravityview_view->getCurrentField();
163 163
 		}
164 164
 
165 165
 		$output_arr = array();
166 166
 
167 167
 		// Get an array of file paths for the field.
168
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
168
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
169 169
 
170 170
 		// The $value JSON was probably truncated; let's check lead_detail_long.
171 171
 		if ( ! is_array( $file_paths ) ) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			$rendered = null;
186 186
 
187 187
 			// If the site is HTTPS, use HTTPS
188
-			if ( function_exists('set_url_scheme') ) {
188
+			if ( function_exists( 'set_url_scheme' ) ) {
189 189
 				$file_path = set_url_scheme( $file_path );
190 190
 			}
191 191
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			$file_path_info = pathinfo( $file_path );
197 197
 
198 198
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
199
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
199
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
200 200
 
201 201
 			/**
202 202
 			 * @filter `gravityview/fields/fileupload/extension` Modify the file extension before it's used in display logic
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			$extension = apply_filters( 'gravityview/fields/fileupload/extension', $extension, $file_path );
208 208
 
209
-			$basename = $file_path_info['basename'];
209
+			$basename = $file_path_info[ 'basename' ];
210 210
 
211 211
 			// Get the secure download URL
212 212
 			$is_secure = false;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 					 */
247 247
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
248 248
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
249
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
249
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
250 250
 					), $context );
251 251
 
252 252
 					/**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 					 */
276 276
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
277 277
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
278
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
278
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
279 279
 					), $context );
280 280
 
281 281
 					/**
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
 					$file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path );
300 300
 				}
301 301
 
302
-				$field_settings['link_to_file'] = true;
302
+				$field_settings[ 'link_to_file' ] = true;
303 303
 
304 304
 			// Images
305 305
 			} else if ( in_array( $extension, GravityView_Image::get_image_extensions() ) ) {
306 306
 				$width = \GV\Utils::get( $field_settings, 'image_width', 250 );
307 307
 				$image_atts = array(
308 308
 					'src'   => $file_path,
309
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
310
-					'alt'   => $field_settings['label'],
311
-					'width' => ( $is_single ? null : ( $width ? $width: 250 ) )
309
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
310
+					'alt'   => $field_settings[ 'label' ],
311
+					'width' => ( $is_single ? null : ( $width ? $width : 250 ) )
312 312
 				);
313 313
 
314 314
 				if ( $is_secure ) {
315
-					$image_atts['validate_src'] = false;
315
+					$image_atts[ 'validate_src' ] = false;
316 316
 				}
317 317
 
318 318
 				/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 				unset( $gv_entry );
335 335
 
336
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
336
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
337 337
 
338 338
 					$lightbox_link_atts = array(
339 339
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 				}
349 349
 
350 350
 				// Show as link should render the image regardless.
351
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
351
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
352 352
 					$text = $rendered;
353 353
 				}
354 354
 			}
355 355
 			// For all other non-media file types (ZIP, for example), always show as a link regardless of setting.
356 356
 			else {
357
-				$field_settings['link_to_file'] = true;
357
+				$field_settings[ 'link_to_file' ] = true;
358 358
 				$disable_lightbox = true;
359 359
 			}
360 360
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
371 371
 
372 372
 			// Output textualized content where
373
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
373
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
374 374
 				/**
375 375
 				 * Modify the link text (defaults to the file name)
376 376
 				 *
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 				 */
384 384
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
385 385
 
386
-				if ( empty( $field_settings['show_as_link'] ) ) {
386
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
387 387
 					/**
388 388
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
389 389
 					 * @since 2.0 Added $context
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				$content = empty( $rendered ) ? $text : $rendered;
405 405
 			}
406 406
 
407
-			$output_arr[] = array(
407
+			$output_arr[ ] = array(
408 408
 				'file_path' => $file_path,
409 409
 				'content' => $content
410 410
 			);
Please login to merge, or discard this patch.
includes/class-gravityview-image.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$atts = wp_parse_args( $atts, $defaults );
67 67
 
68
-		foreach( $atts as $key => $val ) {
68
+		foreach ( $atts as $key => $val ) {
69 69
 			$this->{$key} = $val;
70 70
 		}
71 71
 
72
-		$this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
72
+		$this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
73 73
 
74 74
 		$this->set_image_size();
75 75
 
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function validate_image_src() {
87 87
 
88
-		if ( !$this->validate_src ) { return true; }
88
+		if ( ! $this->validate_src ) { return true; }
89 89
 
90 90
 		$info = pathinfo( $this->src );
91 91
 
92 92
 		$image_exts = self::get_image_extensions();
93 93
 
94
-		return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts);
94
+		return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts );
95 95
 	}
96 96
 
97 97
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 */
110 110
 		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp' ) );
111 111
 
112
-		return (array) $image_exts;
112
+		return (array)$image_exts;
113 113
 	}
114 114
 
115 115
 	/**
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 
126 126
 			// And there is no string size passed
127 127
 			// 		And we want to get the image size using PHP
128
-			if ( empty( $string ) && !empty( $this->getimagesize ) ) {
128
+			if ( empty( $string ) && ! empty( $this->getimagesize ) ) {
129 129
 
130 130
 				$image_size = @getimagesize( $this->src );
131 131
 
132 132
 				// If it didn't return a response, it may be a HTTPS/SSL error
133
-				if ( empty( $image_size[0] ) ) {
133
+				if ( empty( $image_size[ 0 ] ) ) {
134 134
 					$image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) );
135 135
 				}
136 136
 
137
-				if ( !empty( $image_size ) ) {
137
+				if ( ! empty( $image_size ) ) {
138 138
 					list( $width, $height ) = $image_size;
139 139
 				}
140 140
 
@@ -147,33 +147,33 @@  discard block
 block discarded – undo
147 147
 				 * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels
148 148
 				 */
149 149
 				$image_sizes = apply_filters( 'gravityview_image_sizes', array(
150
-					'tiny' => array('width' => 40, 'height' => 30),
151
-					'small' => array('width' => 100, 'height' => 75),
152
-					'medium' => array('width' => 250, 'height' => 188),
153
-					'large' => array('width' => 448, 'height' => 336),
150
+					'tiny' => array( 'width' => 40, 'height' => 30 ),
151
+					'small' => array( 'width' => 100, 'height' => 75 ),
152
+					'medium' => array( 'width' => 250, 'height' => 188 ),
153
+					'large' => array( 'width' => 448, 'height' => 336 ),
154 154
 				) );
155 155
 
156
-				switch( $this->size ) {
156
+				switch ( $this->size ) {
157 157
 					case 'tiny':
158
-						extract($image_sizes['tiny']);
158
+						extract( $image_sizes[ 'tiny' ] );
159 159
 						break;
160 160
 					case 'small':
161 161
 					case 's':
162 162
 					case 'thumb':
163
-						extract($image_sizes['small']);
163
+						extract( $image_sizes[ 'small' ] );
164 164
 						break;
165 165
 					case 'm':
166 166
 					case 'medium':
167
-						extract($image_sizes['medium']);
167
+						extract( $image_sizes[ 'medium' ] );
168 168
 						break;
169 169
 					case 'large':
170 170
 					case 'l':
171
-						extract($image_sizes['large']);
171
+						extract( $image_sizes[ 'large' ] );
172 172
 						break;
173 173
 					default:
174 174
 						// Verify that the passed sizes are integers.
175
-						$width = !empty( $width ) ? intval( $width ) : intval( $this->width );
176
-						$height = !empty( $height ) ? intval( $height ) : intval( $this->height );
175
+						$width = ! empty( $width ) ? intval( $width ) : intval( $this->width );
176
+						$height = ! empty( $height ) ? intval( $height ) : intval( $this->height );
177 177
 				}
178 178
 
179 179
 			}
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$form = false;
126 126
 
127
-		if( $entry ) {
128
-			$form = GFAPI::get_form( $entry['form_id'] );
127
+		if ( $entry ) {
128
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
129 129
 		}
130 130
 
131 131
 		return $form;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			}
202 202
 		}
203 203
 
204
-		return (bool) $has_transaction_data;
204
+		return (bool)$has_transaction_data;
205 205
 	}
206 206
 
207 207
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
241 241
 
242
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
242
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
243 243
 
244 244
 		return $result;
245 245
 	}
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
261 261
 	 */
262
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
262
+	public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
263 263
 		$forms = array();
264 264
 		if ( ! class_exists( 'GFAPI' ) ) {
265 265
 			return array();
266 266
 		}
267 267
 
268
-		if( 'any' === $active ) {
268
+		if ( 'any' === $active ) {
269 269
 			$active_forms = GFAPI::get_forms( true, $trash );
270 270
 			$inactive_forms = GFAPI::get_forms( false, $trash );
271 271
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 		$has_post_fields = false;
298 298
 
299 299
 		if ( $form ) {
300
-			foreach ( $form['fields'] as $field ) {
301
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
302
-					$fields["{$field['id']}"] = array(
300
+			foreach ( $form[ 'fields' ] as $field ) {
301
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
302
+					$fields[ "{$field[ 'id' ]}" ] = array(
303 303
 						'label' => \GV\Utils::get( $field, 'label' ),
304 304
 						'parent' => null,
305 305
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 					);
309 309
 				}
310 310
 
311
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
312
-					foreach ( $field['inputs'] as $input ) {
311
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
312
+					foreach ( $field[ 'inputs' ] as $input ) {
313 313
 
314
-						if( ! empty( $input['isHidden'] ) ) {
314
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
315 315
 							continue;
316 316
 						}
317 317
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
                          * @hack
320 320
                          * In case of email/email confirmation, the input for email has the same id as the parent field
321 321
                          */
322
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
322
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
323 323
                             continue;
324 324
                         }
325
-						$fields["{$input['id']}"] = array(
325
+						$fields[ "{$input[ 'id' ]}" ] = array(
326 326
 							'label' => \GV\Utils::get( $input, 'label' ),
327 327
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
328 328
 							'parent' => $field,
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				}
335 335
 
336 336
 
337
-				if( GFCommon::is_product_field( $field['type'] ) ){
337
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
338 338
 					$has_product_fields = true;
339 339
 				}
340 340
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		 * @since 1.7
349 349
 		 */
350 350
 		if ( $has_post_fields ) {
351
-			$fields['post_id'] = array(
351
+			$fields[ 'post_id' ] = array(
352 352
 				'label' => __( 'Post ID', 'gravityview' ),
353 353
 				'type' => 'post_id',
354 354
 			);
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 			foreach ( $payment_fields as $payment_field ) {
362 362
 
363 363
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
364
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
364
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
365 365
 					continue;
366 366
 				}
367 367
 
368
-				$fields["{$payment_field->name}"] = array(
368
+				$fields[ "{$payment_field->name}" ] = array(
369 369
 					'label' => $payment_field->label,
370 370
 					'desc' => $payment_field->description,
371 371
 					'type' => $payment_field->name,
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 
398 398
 		$fields = array();
399 399
 
400
-		foreach ( $extra_fields as $key => $field ){
401
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
402
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
400
+		foreach ( $extra_fields as $key => $field ) {
401
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
402
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
403 403
 			}
404 404
 		}
405 405
 
@@ -439,33 +439,33 @@  discard block
 block discarded – undo
439 439
 			'search_criteria' => null,
440 440
 			'sorting' => null,
441 441
 			'paging' => null,
442
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
442
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
443 443
 			'context_view_id' => null,
444 444
 		);
445 445
 
446 446
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
447 447
 
448
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
449
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
448
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
449
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
450 450
 
451 451
 				if ( ! is_array( $filter ) ) {
452 452
 					continue;
453 453
 				}
454 454
 
455 455
 				// By default, we want searches to be wildcard for each field.
456
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
456
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
457 457
 
458 458
 				/**
459 459
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
460 460
 				 * @param string $operator Existing search operator
461 461
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
462 462
 				 */
463
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
463
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
464 464
 			}
465 465
 
466 466
 			// don't send just the [mode] without any field filter.
467
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
468
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
467
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
468
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
469 469
 			}
470 470
 
471 471
 		}
@@ -476,33 +476,33 @@  discard block
 block discarded – undo
476 476
 		 * Prepare date formats to be in Gravity Forms DB format;
477 477
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
478 478
 		 */
479
-		foreach ( array('start_date', 'end_date' ) as $key ) {
479
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
480 480
 
481
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
481
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
482 482
 
483 483
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
484
-				$date = date_create( $criteria['search_criteria'][ $key ] );
484
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
485 485
 
486 486
 				if ( $date ) {
487 487
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
488
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
488
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
489 489
 				} else {
490
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
490
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
491 491
 
492 492
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
493
-					unset( $criteria['search_criteria'][ $key ] );
493
+					unset( $criteria[ 'search_criteria' ][ $key ] );
494 494
 				}
495 495
 			}
496 496
 		}
497 497
 
498
-		if ( empty( $criteria['context_view_id'] ) ) {
498
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
499 499
 			// Calculate the context view id and send it to the advanced filter
500 500
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
501
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
501
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
502 502
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
503
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
505
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
505
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
506 506
 			}
507 507
 		}
508 508
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		 * @param array $form_ids Forms to search
513 513
 		 * @param int $view_id ID of the view being used to search
514 514
 		 */
515
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
515
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
516 516
 
517 517
 		return (array)$criteria;
518 518
 	}
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		/** Reduce # of database calls */
547 547
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
548 548
 
549
-		if ( ! empty( $criteria['cache'] ) ) {
549
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
550 550
 
551 551
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
552 552
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 				// Still update the total count when using cached results
556 556
 				if ( ! is_null( $total ) ) {
557
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
557
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
558 558
 				}
559 559
 
560 560
 				$return = $entries;
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
577 577
 
578 578
 			// No entries returned from gravityview_before_get_entries
579
-			if( is_null( $entries ) ) {
579
+			if ( is_null( $entries ) ) {
580 580
 
581
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
581
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
582 582
 
583 583
 				if ( is_wp_error( $entries ) ) {
584 584
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 				}
590 590
 			}
591 591
 
592
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
592
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
593 593
 
594 594
 				// Cache results
595 595
 				$Cache->set( $entries, 'entries' );
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view );
707 707
 
708 708
 		// Is the entry allowed
709
-		if( $check_entry_display ) {
709
+		if ( $check_entry_display ) {
710 710
 
711 711
 			$gvid = \GV\Utils::_GET( 'gvid' );
712 712
 
713
-			if( $gvid ) {
713
+			if ( $gvid ) {
714 714
 				$view = \GV\View::by_id( $gvid );
715 715
 			}
716 716
 
717 717
 			$entry = self::check_entry_display( $entry, $view );
718 718
 		}
719 719
 
720
-		if( is_wp_error( $entry ) ) {
720
+		if ( is_wp_error( $entry ) ) {
721 721
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
722 722
 			return false;
723 723
 		}
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$value = false;
753 753
 
754
-		if( 'context' === $val1 ) {
754
+		if ( 'context' === $val1 ) {
755 755
 
756 756
 			$matching_contexts = array( $val2 );
757 757
 
758 758
 			// We allow for non-standard contexts.
759
-			switch( $val2 ) {
759
+			switch ( $val2 ) {
760 760
 				// Check for either single or edit
761 761
 				case 'singular':
762 762
 					$matching_contexts = array( 'single', 'edit' );
@@ -799,18 +799,18 @@  discard block
 block discarded – undo
799 799
 				$json_val_1 = json_decode( $val1, true );
800 800
 				$json_val_2 = json_decode( $val2, true );
801 801
 
802
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
802
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
803 803
 
804 804
 					$json_in = false;
805
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
806
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
805
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
806
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
807 807
 
808 808
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
809 809
 					foreach ( $json_val_1 as $item_1 ) {
810 810
 						foreach ( $json_val_2 as $item_2 ) {
811 811
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
812 812
 
813
-							if( $json_in ) {
813
+							if ( $json_in ) {
814 814
 								break 2;
815 815
 							}
816 816
 						}
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry, $view = null ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 
880 880
 		$_gvid = \GV\Utils::_GET( 'gvid' );
881 881
 
882
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
882
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
883 883
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
884 884
 		}
885 885
 
886 886
 		$view_form_id = $view->form->ID;
887 887
 
888 888
 		if ( $view->joins ) {
889
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
-				$view_form_id = $entry['form_id'];
889
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
+				$view_form_id = $entry[ 'form_id' ];
891 891
 			}
892 892
 		}
893 893
 
894
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
894
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
895 895
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
896 896
 		}
897 897
 
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 		 * Check whether the entry is in the entries subset by running a modified query.
900 900
 		 */
901 901
 		add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) {
902
-			$_tmp_query       = new \GF_Query( $view_form_id, array(
902
+			$_tmp_query = new \GF_Query( $view_form_id, array(
903 903
 				'field_filters' => array(
904 904
 					'mode' => 'all',
905 905
 					array(
906 906
 						'key' => 'id',
907 907
 						'operation' => 'is',
908
-						'value' => $entry['id']
908
+						'value' => $entry[ 'id' ]
909 909
 					)
910 910
 				)
911 911
 			) );
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 			/** @type \GF_Query $query */
916 916
 			$query_parts      = $query->_introspect();
917 917
 
918
-			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
918
+			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
919 919
 
920 920
 		}, 10, 3 );
921 921
 
922 922
 		// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
923 923
 		add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
924 924
 
925
-			$criteria['paging'] = array(
925
+			$criteria[ 'paging' ] = array(
926 926
 				'offset' => 0,
927 927
 				'page_size' => 25
928 928
 			);
@@ -941,20 +941,20 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 		// This entry is on a View with joins
944
-		if ( $entries[0]->is_multi() ) {
944
+		if ( $entries[ 0 ]->is_multi() ) {
945 945
 
946 946
 			$multi_entry_ids = array();
947 947
 
948
-			foreach ( $entries[0]->entries as $multi_entry ) {
949
-				$multi_entry_ids[] = (int) $multi_entry->ID;
948
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
949
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
950 950
 			}
951 951
 
952
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
952
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
953 953
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
954 954
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
955 955
 			}
956 956
 
957
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
957
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
958 958
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
959 959
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
960 960
 		}
@@ -999,18 +999,18 @@  discard block
 block discarded – undo
999 999
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1000 1000
 		 * @see GFCommon::format_date() for original code
1001 1001
 		 */
1002
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1002
+		$date_gmt_time = mysql2date( 'G', $date_string );
1003 1003
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1004 1004
 
1005
-		$format  = \GV\Utils::get( $atts, 'format' );
1006
-		$is_human  = ! empty( $atts['human'] );
1007
-		$is_diff  = ! empty( $atts['diff'] );
1008
-		$is_raw = ! empty( $atts['raw'] );
1009
-		$is_timestamp = ! empty( $atts['timestamp'] );
1010
-		$include_time = ! empty( $atts['time'] );
1005
+		$format = \GV\Utils::get( $atts, 'format' );
1006
+		$is_human = ! empty( $atts[ 'human' ] );
1007
+		$is_diff = ! empty( $atts[ 'diff' ] );
1008
+		$is_raw = ! empty( $atts[ 'raw' ] );
1009
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1010
+		$include_time = ! empty( $atts[ 'time' ] );
1011 1011
 
1012 1012
 		// If we're using time diff, we want to have a different default format
1013
-		if( empty( $format ) ) {
1013
+		if ( empty( $format ) ) {
1014 1014
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1015 1015
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1016 1016
 		}
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		// If raw was specified, don't modify the stored value
1019 1019
 		if ( $is_raw ) {
1020 1020
 			$formatted_date = $date_string;
1021
-		} elseif( $is_timestamp ) {
1021
+		} elseif ( $is_timestamp ) {
1022 1022
 			$formatted_date = $date_local_timestamp;
1023 1023
 		} elseif ( $is_diff ) {
1024 1024
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 		$label = \GV\Utils::get( $field, 'label' );
1053 1053
 
1054
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1054
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1055 1055
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1056 1056
 		}
1057 1057
 
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			$form = GFAPI::get_form( $form );
1079 1079
 		}
1080 1080
 
1081
-		if ( class_exists( 'GFFormsModel' ) ){
1081
+		if ( class_exists( 'GFFormsModel' ) ) {
1082 1082
 			return GFFormsModel::get_field( $form, $field_id );
1083 1083
 		} else {
1084 1084
 			return null;
@@ -1125,19 +1125,19 @@  discard block
 block discarded – undo
1125 1125
 			$shortcodes = array();
1126 1126
 
1127 1127
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1128
-			if ( empty( $matches ) ){
1128
+			if ( empty( $matches ) ) {
1129 1129
 				return false;
1130 1130
 			}
1131 1131
 
1132 1132
 			foreach ( $matches as $shortcode ) {
1133
-				if ( $tag === $shortcode[2] ) {
1133
+				if ( $tag === $shortcode[ 2 ] ) {
1134 1134
 
1135 1135
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1136
-					$shortcodes[] = $shortcode;
1136
+					$shortcodes[ ] = $shortcode;
1137 1137
 
1138
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1139
-					foreach( $results as $result ) {
1140
-						$shortcodes[] = $result;
1138
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1139
+					foreach ( $results as $result ) {
1140
+						$shortcodes[ ] = $result;
1141 1141
 					}
1142 1142
 				}
1143 1143
 			}
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			'post_type'      => 'gravityview',
1170 1170
 			'posts_per_page' => 100,
1171 1171
 			'meta_key'       => '_gravityview_form_id',
1172
-			'meta_value'     => (int) $form_id,
1172
+			'meta_value'     => (int)$form_id,
1173 1173
 		);
1174 1174
 		$args     = wp_parse_args( $args, $defaults );
1175 1175
 		$views    = get_posts( $args );
@@ -1181,21 +1181,21 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
 			$data = unserialize( $view->meta_value );
1183 1183
 
1184
-			if( ! $data || ! is_array( $data ) ) {
1184
+			if ( ! $data || ! is_array( $data ) ) {
1185 1185
 				continue;
1186 1186
 			}
1187 1187
 
1188 1188
 			foreach ( $data as $datum ) {
1189
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1190
-					$joined_forms[] = $view->post_id;
1189
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1190
+					$joined_forms[ ] = $view->post_id;
1191 1191
 				}
1192 1192
 			}
1193 1193
 		}
1194 1194
 
1195 1195
 		if ( $joined_forms ) {
1196
-			$joined_args  = array(
1196
+			$joined_args = array(
1197 1197
 				'post_type'      => 'gravityview',
1198
-				'posts_per_page' => $args['posts_per_page'],
1198
+				'posts_per_page' => $args[ 'posts_per_page' ],
1199 1199
 				'post__in'       => $joined_forms,
1200 1200
 			);
1201 1201
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1353 1353
 
1354
-		if( $json_decode ) {
1354
+		if ( $json_decode ) {
1355 1355
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1356 1356
 		}
1357 1357
 
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	 * @return string         html
1367 1367
 	 */
1368 1368
 	public static function get_sortable_fields( $formid, $current = '' ) {
1369
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default (Entry ID)', 'gravityview' ) .'</option>';
1369
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default (Entry ID)', 'gravityview' ) . '</option>';
1370 1370
 
1371 1371
 		if ( empty( $formid ) ) {
1372 1372
 			return $output;
@@ -1383,11 +1383,11 @@  discard block
 block discarded – undo
1383 1383
 			$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1384 1384
 
1385 1385
 			foreach ( $fields as $id => $field ) {
1386
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
1386
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1387 1387
 					continue;
1388 1388
 				}
1389 1389
 
1390
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1390
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1391 1391
 			}
1392 1392
 		}
1393 1393
 
@@ -1430,16 +1430,16 @@  discard block
 block discarded – undo
1430 1430
 		$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1431 1431
 
1432 1432
 		// TODO: Convert to using array_filter
1433
-		foreach( $fields as $id => $field ) {
1433
+		foreach ( $fields as $id => $field ) {
1434 1434
 
1435
-			if( in_array( $field['type'], $blocklist_field_types ) ) {
1435
+			if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1436 1436
 				unset( $fields[ $id ] );
1437 1437
 			}
1438 1438
 
1439 1439
 			/**
1440 1440
 			 * Merge date and time subfields.
1441 1441
 			 */
1442
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1442
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1443 1443
 				$fields[ intval( $id ) ] = array(
1444 1444
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1445 1445
 					'parent' => null,
@@ -1489,14 +1489,14 @@  discard block
 block discarded – undo
1489 1489
 	 * @param  int|array  $field field key or field array
1490 1490
 	 * @return boolean
1491 1491
 	 */
1492
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1492
+	public static function is_field_numeric( $form = null, $field = '' ) {
1493 1493
 
1494 1494
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1495 1495
 			$form = self::get_form( $form );
1496 1496
 		}
1497 1497
 
1498 1498
 		// If entry meta, it's a string. Otherwise, numeric
1499
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1499
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1500 1500
 			$type = $field;
1501 1501
 		} else {
1502 1502
 			$type = self::get_field_type( $form, $field );
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1511 1511
 
1512 1512
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1513
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1514
-			if( true === $gv_field->is_numeric ) {
1515
-				$numeric_types[] = $gv_field->is_numeric;
1513
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1514
+			if ( true === $gv_field->is_numeric ) {
1515
+				$numeric_types[ ] = $gv_field->is_numeric;
1516 1516
 			}
1517 1517
 		}
1518 1518
 
@@ -1663,20 +1663,20 @@  discard block
 block discarded – undo
1663 1663
 		$final_atts = array_filter( $final_atts );
1664 1664
 
1665 1665
 		// If the href wasn't passed as an attribute, use the value passed to the function
1666
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1667
-			$final_atts['href'] = $href;
1666
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1667
+			$final_atts[ 'href' ] = $href;
1668 1668
 		}
1669 1669
 
1670
-		if ( isset( $final_atts['href'] ) ) {
1671
-			$final_atts['href'] = esc_url_raw( $final_atts['href'] );
1670
+		if ( isset( $final_atts[ 'href' ] ) ) {
1671
+			$final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] );
1672 1672
 		}
1673 1673
 
1674 1674
 		/**
1675 1675
 		 * Fix potential security issue with target=_blank
1676 1676
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1677 1677
 		 */
1678
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1679
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1678
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1679
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1680 1680
 		}
1681 1681
 
1682 1682
 		// Sort the attributes alphabetically, to help testing
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1689 1689
 		}
1690 1690
 
1691
-		if( '' !== $output ) {
1691
+		if ( '' !== $output ) {
1692 1692
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1693 1693
 		}
1694 1694
 
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1716 1716
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1717 1717
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1718
-				$merged[] = $value;
1718
+				$merged[ ] = $value;
1719 1719
 			} else {
1720 1720
 				$merged[ $key ] = $value;
1721 1721
 			}
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1749 1749
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1750 1750
 		 */
1751
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1751
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1752 1752
 
1753 1753
 		return get_users( $get_users_settings );
1754 1754
 	}
@@ -1768,11 +1768,11 @@  discard block
 block discarded – undo
1768 1768
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1769 1769
 
1770 1770
     	// If $cap is defined, only show notice if user has capability
1771
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1771
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1772 1772
     		return '';
1773 1773
 	    }
1774 1774
 
1775
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1775
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1776 1776
     }
1777 1777
 
1778 1778
 	/**
Please login to merge, or discard this patch.
includes/class-gravityview-logging.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 	function __construct() {
11 11
 
12
-		add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 );
12
+		add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 );
13 13
 
14
-		add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 );
14
+		add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 );
15 15
 
16 16
 		// Enable debug with Gravity Forms Logging Add-on
17 17
 	    add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 			include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' );
37 37
 		}
38 38
 
39
-		$panels[] = new GravityView_Debug_Bar;
39
+		$panels[ ] = new GravityView_Debug_Bar;
40 40
 
41 41
 		return $panels;
42 42
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $supported_plugins List of plugins
47 47
 	 */
48 48
 	public function enable_gform_logging( $supported_plugins ) {
49
-	    $supported_plugins['gravityview'] = 'GravityView';
49
+	    $supported_plugins[ 'gravityview' ] = 'GravityView';
50 50
 	    return $supported_plugins;
51 51
 	}
52 52
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @return string "print_r" or "var_export"
75 75
 	 */
76 76
 	static function get_print_function() {
77
-		if( ob_get_level() > 0 ) {
77
+		if ( ob_get_level() > 0 ) {
78 78
 			$function = 'var_export';
79 79
 		} else {
80 80
 			$function = 'print_r';
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 		$hash = md5( json_encode( $notice ) );
96 96
 
97 97
 		if ( ! isset( self::$notices_hash[ $hash ] ) ) {
98
-			self::$notices[]             = $notice;
98
+			self::$notices[ ]             = $notice;
99 99
 			self::$notices_hash[ $hash ] = true;
100 100
 		}
101 101
 
102
-		if ( class_exists("GFLogging") ) {
102
+		if ( class_exists( "GFLogging" ) ) {
103 103
 			GFLogging::include_logger();
104
-	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
104
+	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG );
105 105
 	    }
106 106
 	}
107 107
 
108
-	static function log_error( $message = '', $data = null  ) {
108
+	static function log_error( $message = '', $data = null ) {
109 109
 
110 110
 		$function = self::get_print_function();
111 111
 
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 		$hash = md5( json_encode( $error ) );
119 119
 
120 120
 		if ( ! isset( self::$errors_hash[ $hash ] ) ) {
121
-			self::$errors[]             = $error;
121
+			self::$errors[ ]             = $error;
122 122
 			self::$errors_hash[ $hash ] = true;
123 123
 		}
124 124
 
125
-		if ( class_exists("GFLogging") ) {
125
+		if ( class_exists( "GFLogging" ) ) {
126 126
 		    GFLogging::include_logger();
127
-		    GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR );
127
+		    GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $error, true ), KLogger::ERROR );
128 128
 		}
129 129
 	}
130 130
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	static function is_logging_active( $plugin = 'gravityview' ) {
143 143
 
144
-		if( ! class_exists( 'GFLogging') ) {
144
+		if ( ! class_exists( 'GFLogging' ) ) {
145 145
 			return false;
146 146
 		}
147 147
 
Please login to merge, or discard this patch.
trustedlogin/autoload-classmap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 // autoload-classmap.php @generated by Strauss
4 4
 
5
-$trustedlogin = dirname(__FILE__);
5
+$trustedlogin = dirname( __FILE__ );
6 6
 
7 7
 return array(
8 8
    'GravityView\TrustedLogin\Logging' => $trustedlogin . '/trustedlogin/client/src/Logging.php',
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core32/ChaCha20/Ctx.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_ChaCha20_Ctx', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_ChaCha20_Ctx', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -27,40 +27,40 @@  discard block
 block discarded – undo
27 27
      * @throws SodiumException
28 28
      * @throws TypeError
29 29
      */
30
-    public function __construct($key = '', $iv = '', $counter = '')
30
+    public function __construct( $key = '', $iv = '', $counter = '' )
31 31
     {
32
-        if (self::strlen($key) !== 32) {
33
-            throw new InvalidArgumentException('ChaCha20 expects a 256-bit key.');
32
+        if ( self::strlen( $key ) !== 32 ) {
33
+            throw new InvalidArgumentException( 'ChaCha20 expects a 256-bit key.' );
34 34
         }
35
-        if (self::strlen($iv) !== 8) {
36
-            throw new InvalidArgumentException('ChaCha20 expects a 64-bit nonce.');
35
+        if ( self::strlen( $iv ) !== 8 ) {
36
+            throw new InvalidArgumentException( 'ChaCha20 expects a 64-bit nonce.' );
37 37
         }
38
-        $this->container = new SplFixedArray(16);
38
+        $this->container = new SplFixedArray( 16 );
39 39
 
40 40
         /* "expand 32-byte k" as per ChaCha20 spec */
41
-        $this->container[0]  = new ParagonIE_Sodium_Core32_Int32(array(0x6170, 0x7865));
42
-        $this->container[1]  = new ParagonIE_Sodium_Core32_Int32(array(0x3320, 0x646e));
43
-        $this->container[2]  = new ParagonIE_Sodium_Core32_Int32(array(0x7962, 0x2d32));
44
-        $this->container[3]  = new ParagonIE_Sodium_Core32_Int32(array(0x6b20, 0x6574));
41
+        $this->container[ 0 ]  = new ParagonIE_Sodium_Core32_Int32( array( 0x6170, 0x7865 ) );
42
+        $this->container[ 1 ]  = new ParagonIE_Sodium_Core32_Int32( array( 0x3320, 0x646e ) );
43
+        $this->container[ 2 ]  = new ParagonIE_Sodium_Core32_Int32( array( 0x7962, 0x2d32 ) );
44
+        $this->container[ 3 ]  = new ParagonIE_Sodium_Core32_Int32( array( 0x6b20, 0x6574 ) );
45 45
 
46
-        $this->container[4]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 0, 4));
47
-        $this->container[5]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 4, 4));
48
-        $this->container[6]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 8, 4));
49
-        $this->container[7]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 12, 4));
50
-        $this->container[8]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 16, 4));
51
-        $this->container[9]  = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 20, 4));
52
-        $this->container[10] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 24, 4));
53
-        $this->container[11] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 28, 4));
46
+        $this->container[ 4 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 0, 4 ) );
47
+        $this->container[ 5 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 4, 4 ) );
48
+        $this->container[ 6 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 8, 4 ) );
49
+        $this->container[ 7 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 12, 4 ) );
50
+        $this->container[ 8 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 16, 4 ) );
51
+        $this->container[ 9 ]  = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 20, 4 ) );
52
+        $this->container[ 10 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 24, 4 ) );
53
+        $this->container[ 11 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $key, 28, 4 ) );
54 54
 
55
-        if (empty($counter)) {
56
-            $this->container[12] = new ParagonIE_Sodium_Core32_Int32();
57
-            $this->container[13] = new ParagonIE_Sodium_Core32_Int32();
55
+        if ( empty( $counter ) ) {
56
+            $this->container[ 12 ] = new ParagonIE_Sodium_Core32_Int32();
57
+            $this->container[ 13 ] = new ParagonIE_Sodium_Core32_Int32();
58 58
         } else {
59
-            $this->container[12] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($counter, 0, 4));
60
-            $this->container[13] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($counter, 4, 4));
59
+            $this->container[ 12 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $counter, 0, 4 ) );
60
+            $this->container[ 13 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $counter, 4, 4 ) );
61 61
         }
62
-        $this->container[14] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($iv, 0, 4));
63
-        $this->container[15] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($iv, 4, 4));
62
+        $this->container[ 14 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $iv, 0, 4 ) );
63
+        $this->container[ 15 ] = ParagonIE_Sodium_Core32_Int32::fromReverseString( self::substr( $iv, 4, 4 ) );
64 64
     }
65 65
 
66 66
     /**
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
      * @param int|ParagonIE_Sodium_Core32_Int32 $value
71 71
      * @return void
72 72
      */
73
-    #[ReturnTypeWillChange]
74
-    public function offsetSet($offset, $value)
73
+    #[ReturnTypeWillChange ]
74
+    public function offsetSet( $offset, $value )
75 75
     {
76
-        if (!is_int($offset)) {
77
-            throw new InvalidArgumentException('Expected an integer');
76
+        if ( ! is_int( $offset ) ) {
77
+            throw new InvalidArgumentException( 'Expected an integer' );
78 78
         }
79
-        if ($value instanceof ParagonIE_Sodium_Core32_Int32) {
79
+        if ( $value instanceof ParagonIE_Sodium_Core32_Int32 ) {
80 80
             /*
81 81
         } elseif (is_int($value)) {
82 82
             $value = ParagonIE_Sodium_Core32_Int32::fromInt($value);
83 83
             */
84 84
         } else {
85
-            throw new InvalidArgumentException('Expected an integer');
85
+            throw new InvalidArgumentException( 'Expected an integer' );
86 86
         }
87
-        $this->container[$offset] = $value;
87
+        $this->container[ $offset ] = $value;
88 88
     }
89 89
 
90 90
     /**
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
      * @return bool
95 95
      * @psalm-suppress MixedArrayOffset
96 96
      */
97
-    #[ReturnTypeWillChange]
98
-    public function offsetExists($offset)
97
+    #[ReturnTypeWillChange ]
98
+    public function offsetExists( $offset )
99 99
     {
100
-        return isset($this->container[$offset]);
100
+        return isset( $this->container[ $offset ] );
101 101
     }
102 102
 
103 103
     /**
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
      * @return void
108 108
      * @psalm-suppress MixedArrayOffset
109 109
      */
110
-    #[ReturnTypeWillChange]
111
-    public function offsetUnset($offset)
110
+    #[ReturnTypeWillChange ]
111
+    public function offsetUnset( $offset )
112 112
     {
113
-        unset($this->container[$offset]);
113
+        unset( $this->container[ $offset ] );
114 114
     }
115 115
 
116 116
     /**
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      * @return mixed|null
121 121
      * @psalm-suppress MixedArrayOffset
122 122
      */
123
-    #[ReturnTypeWillChange]
124
-    public function offsetGet($offset)
123
+    #[ReturnTypeWillChange ]
124
+    public function offsetGet( $offset )
125 125
     {
126
-        return isset($this->container[$offset])
127
-            ? $this->container[$offset]
126
+        return isset( $this->container[ $offset ] )
127
+            ? $this->container[ $offset ]
128 128
             : null;
129 129
     }
130 130
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core32/Curve25519/Fe.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core32_Curve25519_Fe', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core32_Curve25519_Fe', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
      * @throws SodiumException
31 31
      * @throws TypeError
32 32
      */
33
-    public static function fromArray($array, $save_indexes = null)
33
+    public static function fromArray( $array, $save_indexes = null )
34 34
     {
35
-        $count = count($array);
36
-        if ($save_indexes) {
37
-            $keys = array_keys($array);
35
+        $count = count( $array );
36
+        if ( $save_indexes ) {
37
+            $keys = array_keys( $array );
38 38
         } else {
39
-            $keys = range(0, $count - 1);
39
+            $keys = range( 0, $count - 1 );
40 40
         }
41
-        $array = array_values($array);
41
+        $array = array_values( $array );
42 42
 
43 43
         $obj = new ParagonIE_Sodium_Core32_Curve25519_Fe();
44
-        if ($save_indexes) {
45
-            for ($i = 0; $i < $count; ++$i) {
46
-                $array[$i]->overflow = 0;
47
-                $obj->offsetSet($keys[$i], $array[$i]);
44
+        if ( $save_indexes ) {
45
+            for ( $i = 0; $i < $count; ++$i ) {
46
+                $array[ $i ]->overflow = 0;
47
+                $obj->offsetSet( $keys[ $i ], $array[ $i ] );
48 48
             }
49 49
         } else {
50
-            for ($i = 0; $i < $count; ++$i) {
51
-                $array[$i]->overflow = 0;
52
-                $obj->offsetSet($i, $array[$i]);
50
+            for ( $i = 0; $i < $count; ++$i ) {
51
+                $array[ $i ]->overflow = 0;
52
+                $obj->offsetSet( $i, $array[ $i ] );
53 53
             }
54 54
         }
55 55
         return $obj;
@@ -64,32 +64,32 @@  discard block
 block discarded – undo
64 64
      * @throws SodiumException
65 65
      * @throws TypeError
66 66
      */
67
-    public static function fromIntArray($array, $save_indexes = null)
67
+    public static function fromIntArray( $array, $save_indexes = null )
68 68
     {
69
-        $count = count($array);
70
-        if ($save_indexes) {
71
-            $keys = array_keys($array);
69
+        $count = count( $array );
70
+        if ( $save_indexes ) {
71
+            $keys = array_keys( $array );
72 72
         } else {
73
-            $keys = range(0, $count - 1);
73
+            $keys = range( 0, $count - 1 );
74 74
         }
75
-        $array = array_values($array);
75
+        $array = array_values( $array );
76 76
         $set = array();
77 77
         /** @var int $i */
78 78
         /** @var int $v */
79
-        foreach ($array as $i => $v) {
80
-            $set[$i] = ParagonIE_Sodium_Core32_Int32::fromInt($v);
79
+        foreach ( $array as $i => $v ) {
80
+            $set[ $i ] = ParagonIE_Sodium_Core32_Int32::fromInt( $v );
81 81
         }
82 82
 
83 83
         $obj = new ParagonIE_Sodium_Core32_Curve25519_Fe();
84
-        if ($save_indexes) {
85
-            for ($i = 0; $i < $count; ++$i) {
86
-                $set[$i]->overflow = 0;
87
-                $obj->offsetSet($keys[$i], $set[$i]);
84
+        if ( $save_indexes ) {
85
+            for ( $i = 0; $i < $count; ++$i ) {
86
+                $set[ $i ]->overflow = 0;
87
+                $obj->offsetSet( $keys[ $i ], $set[ $i ] );
88 88
             }
89 89
         } else {
90
-            for ($i = 0; $i < $count; ++$i) {
91
-                $set[$i]->overflow = 0;
92
-                $obj->offsetSet($i, $set[$i]);
90
+            for ( $i = 0; $i < $count; ++$i ) {
91
+                $set[ $i ]->overflow = 0;
92
+                $obj->offsetSet( $i, $set[ $i ] );
93 93
             }
94 94
         }
95 95
         return $obj;
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
      * @throws SodiumException
105 105
      * @throws TypeError
106 106
      */
107
-    #[ReturnTypeWillChange]
108
-    public function offsetSet($offset, $value)
107
+    #[ReturnTypeWillChange ]
108
+    public function offsetSet( $offset, $value )
109 109
     {
110
-        if (!($value instanceof ParagonIE_Sodium_Core32_Int32)) {
111
-            throw new InvalidArgumentException('Expected an instance of ParagonIE_Sodium_Core32_Int32');
110
+        if ( ! ( $value instanceof ParagonIE_Sodium_Core32_Int32 ) ) {
111
+            throw new InvalidArgumentException( 'Expected an instance of ParagonIE_Sodium_Core32_Int32' );
112 112
         }
113
-        if (is_null($offset)) {
114
-            $this->container[] = $value;
113
+        if ( is_null( $offset ) ) {
114
+            $this->container[ ] = $value;
115 115
         } else {
116
-            ParagonIE_Sodium_Core32_Util::declareScalarType($offset, 'int', 1);
117
-            $this->container[(int) $offset] = $value;
116
+            ParagonIE_Sodium_Core32_Util::declareScalarType( $offset, 'int', 1 );
117
+            $this->container[ (int)$offset ] = $value;
118 118
         }
119 119
     }
120 120
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
      * @return bool
126 126
      * @psalm-suppress MixedArrayOffset
127 127
      */
128
-    #[ReturnTypeWillChange]
129
-    public function offsetExists($offset)
128
+    #[ReturnTypeWillChange ]
129
+    public function offsetExists( $offset )
130 130
     {
131
-        return isset($this->container[$offset]);
131
+        return isset( $this->container[ $offset ] );
132 132
     }
133 133
 
134 134
     /**
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
      * @return void
139 139
      * @psalm-suppress MixedArrayOffset
140 140
      */
141
-    #[ReturnTypeWillChange]
142
-    public function offsetUnset($offset)
141
+    #[ReturnTypeWillChange ]
142
+    public function offsetUnset( $offset )
143 143
     {
144
-        unset($this->container[$offset]);
144
+        unset( $this->container[ $offset ] );
145 145
     }
146 146
 
147 147
     /**
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      * @return ParagonIE_Sodium_Core32_Int32
152 152
      * @psalm-suppress MixedArrayOffset
153 153
      */
154
-    #[ReturnTypeWillChange]
155
-    public function offsetGet($offset)
154
+    #[ReturnTypeWillChange ]
155
+    public function offsetGet( $offset )
156 156
     {
157
-        if (!isset($this->container[$offset])) {
158
-            $this->container[(int) $offset] = new ParagonIE_Sodium_Core32_Int32();
157
+        if ( ! isset( $this->container[ $offset ] ) ) {
158
+            $this->container[ (int)$offset ] = new ParagonIE_Sodium_Core32_Int32();
159 159
         }
160 160
         /** @var ParagonIE_Sodium_Core32_Int32 $get */
161
-        $get = $this->container[$offset];
161
+        $get = $this->container[ $offset ];
162 162
         return $get;
163 163
     }
164 164
 
@@ -169,21 +169,21 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function __debugInfo()
171 171
     {
172
-        if (empty($this->container)) {
172
+        if ( empty( $this->container ) ) {
173 173
             return array();
174 174
         }
175 175
         $c = array(
176
-            (int) ($this->container[0]->toInt()),
177
-            (int) ($this->container[1]->toInt()),
178
-            (int) ($this->container[2]->toInt()),
179
-            (int) ($this->container[3]->toInt()),
180
-            (int) ($this->container[4]->toInt()),
181
-            (int) ($this->container[5]->toInt()),
182
-            (int) ($this->container[6]->toInt()),
183
-            (int) ($this->container[7]->toInt()),
184
-            (int) ($this->container[8]->toInt()),
185
-            (int) ($this->container[9]->toInt())
176
+            (int)( $this->container[ 0 ]->toInt() ),
177
+            (int)( $this->container[ 1 ]->toInt() ),
178
+            (int)( $this->container[ 2 ]->toInt() ),
179
+            (int)( $this->container[ 3 ]->toInt() ),
180
+            (int)( $this->container[ 4 ]->toInt() ),
181
+            (int)( $this->container[ 5 ]->toInt() ),
182
+            (int)( $this->container[ 6 ]->toInt() ),
183
+            (int)( $this->container[ 7 ]->toInt() ),
184
+            (int)( $this->container[ 8 ]->toInt() ),
185
+            (int)( $this->container[ 9 ]->toInt() )
186 186
         );
187
-        return array(implode(', ', $c));
187
+        return array( implode( ', ', $c ) );
188 188
     }
189 189
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/ChaCha20/Ctx.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_ChaCha20_Ctx', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_ChaCha20_Ctx', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
      * @throws InvalidArgumentException
27 27
      * @throws TypeError
28 28
      */
29
-    public function __construct($key = '', $iv = '', $counter = '')
29
+    public function __construct( $key = '', $iv = '', $counter = '' )
30 30
     {
31
-        if (self::strlen($key) !== 32) {
32
-            throw new InvalidArgumentException('ChaCha20 expects a 256-bit key.');
31
+        if ( self::strlen( $key ) !== 32 ) {
32
+            throw new InvalidArgumentException( 'ChaCha20 expects a 256-bit key.' );
33 33
         }
34
-        if (self::strlen($iv) !== 8) {
35
-            throw new InvalidArgumentException('ChaCha20 expects a 64-bit nonce.');
34
+        if ( self::strlen( $iv ) !== 8 ) {
35
+            throw new InvalidArgumentException( 'ChaCha20 expects a 64-bit nonce.' );
36 36
         }
37
-        $this->container = new SplFixedArray(16);
37
+        $this->container = new SplFixedArray( 16 );
38 38
 
39 39
         /* "expand 32-byte k" as per ChaCha20 spec */
40
-        $this->container[0]  = 0x61707865;
41
-        $this->container[1]  = 0x3320646e;
42
-        $this->container[2]  = 0x79622d32;
43
-        $this->container[3]  = 0x6b206574;
44
-        $this->container[4]  = self::load_4(self::substr($key, 0, 4));
45
-        $this->container[5]  = self::load_4(self::substr($key, 4, 4));
46
-        $this->container[6]  = self::load_4(self::substr($key, 8, 4));
47
-        $this->container[7]  = self::load_4(self::substr($key, 12, 4));
48
-        $this->container[8]  = self::load_4(self::substr($key, 16, 4));
49
-        $this->container[9]  = self::load_4(self::substr($key, 20, 4));
50
-        $this->container[10] = self::load_4(self::substr($key, 24, 4));
51
-        $this->container[11] = self::load_4(self::substr($key, 28, 4));
40
+        $this->container[ 0 ]  = 0x61707865;
41
+        $this->container[ 1 ]  = 0x3320646e;
42
+        $this->container[ 2 ]  = 0x79622d32;
43
+        $this->container[ 3 ]  = 0x6b206574;
44
+        $this->container[ 4 ]  = self::load_4( self::substr( $key, 0, 4 ) );
45
+        $this->container[ 5 ]  = self::load_4( self::substr( $key, 4, 4 ) );
46
+        $this->container[ 6 ]  = self::load_4( self::substr( $key, 8, 4 ) );
47
+        $this->container[ 7 ]  = self::load_4( self::substr( $key, 12, 4 ) );
48
+        $this->container[ 8 ]  = self::load_4( self::substr( $key, 16, 4 ) );
49
+        $this->container[ 9 ]  = self::load_4( self::substr( $key, 20, 4 ) );
50
+        $this->container[ 10 ] = self::load_4( self::substr( $key, 24, 4 ) );
51
+        $this->container[ 11 ] = self::load_4( self::substr( $key, 28, 4 ) );
52 52
 
53
-        if (empty($counter)) {
54
-            $this->container[12] = 0;
55
-            $this->container[13] = 0;
53
+        if ( empty( $counter ) ) {
54
+            $this->container[ 12 ] = 0;
55
+            $this->container[ 13 ] = 0;
56 56
         } else {
57
-            $this->container[12] = self::load_4(self::substr($counter, 0, 4));
58
-            $this->container[13] = self::load_4(self::substr($counter, 4, 4));
57
+            $this->container[ 12 ] = self::load_4( self::substr( $counter, 0, 4 ) );
58
+            $this->container[ 13 ] = self::load_4( self::substr( $counter, 4, 4 ) );
59 59
         }
60
-        $this->container[14] = self::load_4(self::substr($iv, 0, 4));
61
-        $this->container[15] = self::load_4(self::substr($iv, 4, 4));
60
+        $this->container[ 14 ] = self::load_4( self::substr( $iv, 0, 4 ) );
61
+        $this->container[ 15 ] = self::load_4( self::substr( $iv, 4, 4 ) );
62 62
     }
63 63
 
64 64
     /**
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
      * @return void
70 70
      * @psalm-suppress MixedArrayOffset
71 71
      */
72
-    #[ReturnTypeWillChange]
73
-    public function offsetSet($offset, $value)
72
+    #[ReturnTypeWillChange ]
73
+    public function offsetSet( $offset, $value )
74 74
     {
75
-        if (!is_int($offset)) {
76
-            throw new InvalidArgumentException('Expected an integer');
75
+        if ( ! is_int( $offset ) ) {
76
+            throw new InvalidArgumentException( 'Expected an integer' );
77 77
         }
78
-        if (!is_int($value)) {
79
-            throw new InvalidArgumentException('Expected an integer');
78
+        if ( ! is_int( $value ) ) {
79
+            throw new InvalidArgumentException( 'Expected an integer' );
80 80
         }
81
-        $this->container[$offset] = $value;
81
+        $this->container[ $offset ] = $value;
82 82
     }
83 83
 
84 84
     /**
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
      * @param int $offset
88 88
      * @return bool
89 89
      */
90
-    #[ReturnTypeWillChange]
91
-    public function offsetExists($offset)
90
+    #[ReturnTypeWillChange ]
91
+    public function offsetExists( $offset )
92 92
     {
93
-        return isset($this->container[$offset]);
93
+        return isset( $this->container[ $offset ] );
94 94
     }
95 95
 
96 96
     /**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
      * @return void
101 101
      * @psalm-suppress MixedArrayOffset
102 102
      */
103
-    #[ReturnTypeWillChange]
104
-    public function offsetUnset($offset)
103
+    #[ReturnTypeWillChange ]
104
+    public function offsetUnset( $offset )
105 105
     {
106
-        unset($this->container[$offset]);
106
+        unset( $this->container[ $offset ] );
107 107
     }
108 108
 
109 109
     /**
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
      * @return mixed|null
114 114
      * @psalm-suppress MixedArrayOffset
115 115
      */
116
-    #[ReturnTypeWillChange]
117
-    public function offsetGet($offset)
116
+    #[ReturnTypeWillChange ]
117
+    public function offsetGet( $offset )
118 118
     {
119
-        return isset($this->container[$offset])
120
-            ? $this->container[$offset]
119
+        return isset( $this->container[ $offset ] )
120
+            ? $this->container[ $offset ]
121 121
             : null;
122 122
     }
123 123
 }
Please login to merge, or discard this patch.
vendor/paragonie/sodium_compat/src/Core/Curve25519.php 1 patch
Spacing   +1611 added lines, -1611 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (class_exists('ParagonIE_Sodium_Core_Curve25519', false)) {
3
+if ( class_exists( 'ParagonIE_Sodium_Core_Curve25519', false ) ) {
4 4
     return;
5 5
 }
6 6
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public static function fe_0()
26 26
     {
27 27
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
28
-            array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
28
+            array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
29 29
         );
30 30
     }
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public static function fe_1()
40 40
     {
41 41
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
42
-            array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
42
+            array( 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
43 43
         );
44 44
     }
45 45
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
     ) {
61 61
         /** @var array<int, int> $arr */
62 62
         $arr = array();
63
-        for ($i = 0; $i < 10; ++$i) {
64
-            $arr[$i] = (int) ($f[$i] + $g[$i]);
63
+        for ( $i = 0; $i < 10; ++$i ) {
64
+            $arr[ $i ] = (int)( $f[ $i ] + $g[ $i ] );
65 65
         }
66
-        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($arr);
66
+        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $arr );
67 67
     }
68 68
 
69 69
     /**
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
         /** @var array<int, int> $h */
86 86
         $h = array();
87 87
         $b *= -1;
88
-        for ($i = 0; $i < 10; ++$i) {
89
-            $x = (($f[$i] ^ $g[$i]) & $b);
90
-            $h[$i] = ($f[$i]) ^ $x;
88
+        for ( $i = 0; $i < 10; ++$i ) {
89
+            $x = ( ( $f[ $i ] ^ $g[ $i ] ) & $b );
90
+            $h[ $i ] = ( $f[ $i ] ) ^ $x;
91 91
         }
92
-        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($h);
92
+        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $h );
93 93
     }
94 94
 
95 95
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $f
101 101
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
102 102
      */
103
-    public static function fe_copy(ParagonIE_Sodium_Core_Curve25519_Fe $f)
103
+    public static function fe_copy( ParagonIE_Sodium_Core_Curve25519_Fe $f )
104 104
     {
105 105
         $h = clone $f;
106 106
         return $h;
@@ -117,66 +117,66 @@  discard block
 block discarded – undo
117 117
      * @throws RangeException
118 118
      * @throws TypeError
119 119
      */
120
-    public static function fe_frombytes($s)
120
+    public static function fe_frombytes( $s )
121 121
     {
122
-        if (self::strlen($s) !== 32) {
123
-            throw new RangeException('Expected a 32-byte string.');
122
+        if ( self::strlen( $s ) !== 32 ) {
123
+            throw new RangeException( 'Expected a 32-byte string.' );
124 124
         }
125
-        $h0 = self::load_4($s);
126
-        $h1 = self::load_3(self::substr($s, 4, 3)) << 6;
127
-        $h2 = self::load_3(self::substr($s, 7, 3)) << 5;
128
-        $h3 = self::load_3(self::substr($s, 10, 3)) << 3;
129
-        $h4 = self::load_3(self::substr($s, 13, 3)) << 2;
130
-        $h5 = self::load_4(self::substr($s, 16, 4));
131
-        $h6 = self::load_3(self::substr($s, 20, 3)) << 7;
132
-        $h7 = self::load_3(self::substr($s, 23, 3)) << 5;
133
-        $h8 = self::load_3(self::substr($s, 26, 3)) << 4;
134
-        $h9 = (self::load_3(self::substr($s, 29, 3)) & 8388607) << 2;
135
-
136
-        $carry9 = ($h9 + (1 << 24)) >> 25;
137
-        $h0 += self::mul($carry9, 19, 5);
125
+        $h0 = self::load_4( $s );
126
+        $h1 = self::load_3( self::substr( $s, 4, 3 ) ) << 6;
127
+        $h2 = self::load_3( self::substr( $s, 7, 3 ) ) << 5;
128
+        $h3 = self::load_3( self::substr( $s, 10, 3 ) ) << 3;
129
+        $h4 = self::load_3( self::substr( $s, 13, 3 ) ) << 2;
130
+        $h5 = self::load_4( self::substr( $s, 16, 4 ) );
131
+        $h6 = self::load_3( self::substr( $s, 20, 3 ) ) << 7;
132
+        $h7 = self::load_3( self::substr( $s, 23, 3 ) ) << 5;
133
+        $h8 = self::load_3( self::substr( $s, 26, 3 ) ) << 4;
134
+        $h9 = ( self::load_3( self::substr( $s, 29, 3 ) ) & 8388607 ) << 2;
135
+
136
+        $carry9 = ( $h9 + ( 1 << 24 ) ) >> 25;
137
+        $h0 += self::mul( $carry9, 19, 5 );
138 138
         $h9 -= $carry9 << 25;
139
-        $carry1 = ($h1 + (1 << 24)) >> 25;
139
+        $carry1 = ( $h1 + ( 1 << 24 ) ) >> 25;
140 140
         $h2 += $carry1;
141 141
         $h1 -= $carry1 << 25;
142
-        $carry3 = ($h3 + (1 << 24)) >> 25;
142
+        $carry3 = ( $h3 + ( 1 << 24 ) ) >> 25;
143 143
         $h4 += $carry3;
144 144
         $h3 -= $carry3 << 25;
145
-        $carry5 = ($h5 + (1 << 24)) >> 25;
145
+        $carry5 = ( $h5 + ( 1 << 24 ) ) >> 25;
146 146
         $h6 += $carry5;
147 147
         $h5 -= $carry5 << 25;
148
-        $carry7 = ($h7 + (1 << 24)) >> 25;
148
+        $carry7 = ( $h7 + ( 1 << 24 ) ) >> 25;
149 149
         $h8 += $carry7;
150 150
         $h7 -= $carry7 << 25;
151 151
 
152
-        $carry0 = ($h0 + (1 << 25)) >> 26;
152
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
153 153
         $h1 += $carry0;
154 154
         $h0 -= $carry0 << 26;
155
-        $carry2 = ($h2 + (1 << 25)) >> 26;
155
+        $carry2 = ( $h2 + ( 1 << 25 ) ) >> 26;
156 156
         $h3 += $carry2;
157 157
         $h2 -= $carry2 << 26;
158
-        $carry4 = ($h4 + (1 << 25)) >> 26;
158
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
159 159
         $h5 += $carry4;
160 160
         $h4 -= $carry4 << 26;
161
-        $carry6 = ($h6 + (1 << 25)) >> 26;
161
+        $carry6 = ( $h6 + ( 1 << 25 ) ) >> 26;
162 162
         $h7 += $carry6;
163 163
         $h6 -= $carry6 << 26;
164
-        $carry8 = ($h8 + (1 << 25)) >> 26;
164
+        $carry8 = ( $h8 + ( 1 << 25 ) ) >> 26;
165 165
         $h9 += $carry8;
166 166
         $h8 -= $carry8 << 26;
167 167
 
168 168
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
169 169
             array(
170
-                (int) $h0,
171
-                (int) $h1,
172
-                (int) $h2,
173
-                (int) $h3,
174
-                (int) $h4,
175
-                (int) $h5,
176
-                (int) $h6,
177
-                (int) $h7,
178
-                (int) $h8,
179
-                (int) $h9
170
+                (int)$h0,
171
+                (int)$h1,
172
+                (int)$h2,
173
+                (int)$h3,
174
+                (int)$h4,
175
+                (int)$h5,
176
+                (int)$h6,
177
+                (int)$h7,
178
+                (int)$h8,
179
+                (int)$h9
180 180
             )
181 181
         );
182 182
     }
@@ -189,32 +189,32 @@  discard block
 block discarded – undo
189 189
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $h
190 190
      * @return string
191 191
      */
192
-    public static function fe_tobytes(ParagonIE_Sodium_Core_Curve25519_Fe $h)
192
+    public static function fe_tobytes( ParagonIE_Sodium_Core_Curve25519_Fe $h )
193 193
     {
194
-        $h0 = (int) $h[0];
195
-        $h1 = (int) $h[1];
196
-        $h2 = (int) $h[2];
197
-        $h3 = (int) $h[3];
198
-        $h4 = (int) $h[4];
199
-        $h5 = (int) $h[5];
200
-        $h6 = (int) $h[6];
201
-        $h7 = (int) $h[7];
202
-        $h8 = (int) $h[8];
203
-        $h9 = (int) $h[9];
204
-
205
-        $q = (self::mul($h9, 19, 5) + (1 << 24)) >> 25;
206
-        $q = ($h0 + $q) >> 26;
207
-        $q = ($h1 + $q) >> 25;
208
-        $q = ($h2 + $q) >> 26;
209
-        $q = ($h3 + $q) >> 25;
210
-        $q = ($h4 + $q) >> 26;
211
-        $q = ($h5 + $q) >> 25;
212
-        $q = ($h6 + $q) >> 26;
213
-        $q = ($h7 + $q) >> 25;
214
-        $q = ($h8 + $q) >> 26;
215
-        $q = ($h9 + $q) >> 25;
216
-
217
-        $h0 += self::mul($q, 19, 5);
194
+        $h0 = (int)$h[ 0 ];
195
+        $h1 = (int)$h[ 1 ];
196
+        $h2 = (int)$h[ 2 ];
197
+        $h3 = (int)$h[ 3 ];
198
+        $h4 = (int)$h[ 4 ];
199
+        $h5 = (int)$h[ 5 ];
200
+        $h6 = (int)$h[ 6 ];
201
+        $h7 = (int)$h[ 7 ];
202
+        $h8 = (int)$h[ 8 ];
203
+        $h9 = (int)$h[ 9 ];
204
+
205
+        $q = ( self::mul( $h9, 19, 5 ) + ( 1 << 24 ) ) >> 25;
206
+        $q = ( $h0 + $q ) >> 26;
207
+        $q = ( $h1 + $q ) >> 25;
208
+        $q = ( $h2 + $q ) >> 26;
209
+        $q = ( $h3 + $q ) >> 25;
210
+        $q = ( $h4 + $q ) >> 26;
211
+        $q = ( $h5 + $q ) >> 25;
212
+        $q = ( $h6 + $q ) >> 26;
213
+        $q = ( $h7 + $q ) >> 25;
214
+        $q = ( $h8 + $q ) >> 26;
215
+        $q = ( $h9 + $q ) >> 25;
216
+
217
+        $h0 += self::mul( $q, 19, 5 );
218 218
 
219 219
         $carry0 = $h0 >> 26;
220 220
         $h1 += $carry0;
@@ -250,40 +250,40 @@  discard block
 block discarded – undo
250 250
          * @var array<int, int>
251 251
          */
252 252
         $s = array(
253
-            (int) (($h0 >> 0) & 0xff),
254
-            (int) (($h0 >> 8) & 0xff),
255
-            (int) (($h0 >> 16) & 0xff),
256
-            (int) ((($h0 >> 24) | ($h1 << 2)) & 0xff),
257
-            (int) (($h1 >> 6) & 0xff),
258
-            (int) (($h1 >> 14) & 0xff),
259
-            (int) ((($h1 >> 22) | ($h2 << 3)) & 0xff),
260
-            (int) (($h2 >> 5) & 0xff),
261
-            (int) (($h2 >> 13) & 0xff),
262
-            (int) ((($h2 >> 21) | ($h3 << 5)) & 0xff),
263
-            (int) (($h3 >> 3) & 0xff),
264
-            (int) (($h3 >> 11) & 0xff),
265
-            (int) ((($h3 >> 19) | ($h4 << 6)) & 0xff),
266
-            (int) (($h4 >> 2) & 0xff),
267
-            (int) (($h4 >> 10) & 0xff),
268
-            (int) (($h4 >> 18) & 0xff),
269
-            (int) (($h5 >> 0) & 0xff),
270
-            (int) (($h5 >> 8) & 0xff),
271
-            (int) (($h5 >> 16) & 0xff),
272
-            (int) ((($h5 >> 24) | ($h6 << 1)) & 0xff),
273
-            (int) (($h6 >> 7) & 0xff),
274
-            (int) (($h6 >> 15) & 0xff),
275
-            (int) ((($h6 >> 23) | ($h7 << 3)) & 0xff),
276
-            (int) (($h7 >> 5) & 0xff),
277
-            (int) (($h7 >> 13) & 0xff),
278
-            (int) ((($h7 >> 21) | ($h8 << 4)) & 0xff),
279
-            (int) (($h8 >> 4) & 0xff),
280
-            (int) (($h8 >> 12) & 0xff),
281
-            (int) ((($h8 >> 20) | ($h9 << 6)) & 0xff),
282
-            (int) (($h9 >> 2) & 0xff),
283
-            (int) (($h9 >> 10) & 0xff),
284
-            (int) (($h9 >> 18) & 0xff)
253
+            (int)( ( $h0 >> 0 ) & 0xff ),
254
+            (int)( ( $h0 >> 8 ) & 0xff ),
255
+            (int)( ( $h0 >> 16 ) & 0xff ),
256
+            (int)( ( ( $h0 >> 24 ) | ( $h1 << 2 ) ) & 0xff ),
257
+            (int)( ( $h1 >> 6 ) & 0xff ),
258
+            (int)( ( $h1 >> 14 ) & 0xff ),
259
+            (int)( ( ( $h1 >> 22 ) | ( $h2 << 3 ) ) & 0xff ),
260
+            (int)( ( $h2 >> 5 ) & 0xff ),
261
+            (int)( ( $h2 >> 13 ) & 0xff ),
262
+            (int)( ( ( $h2 >> 21 ) | ( $h3 << 5 ) ) & 0xff ),
263
+            (int)( ( $h3 >> 3 ) & 0xff ),
264
+            (int)( ( $h3 >> 11 ) & 0xff ),
265
+            (int)( ( ( $h3 >> 19 ) | ( $h4 << 6 ) ) & 0xff ),
266
+            (int)( ( $h4 >> 2 ) & 0xff ),
267
+            (int)( ( $h4 >> 10 ) & 0xff ),
268
+            (int)( ( $h4 >> 18 ) & 0xff ),
269
+            (int)( ( $h5 >> 0 ) & 0xff ),
270
+            (int)( ( $h5 >> 8 ) & 0xff ),
271
+            (int)( ( $h5 >> 16 ) & 0xff ),
272
+            (int)( ( ( $h5 >> 24 ) | ( $h6 << 1 ) ) & 0xff ),
273
+            (int)( ( $h6 >> 7 ) & 0xff ),
274
+            (int)( ( $h6 >> 15 ) & 0xff ),
275
+            (int)( ( ( $h6 >> 23 ) | ( $h7 << 3 ) ) & 0xff ),
276
+            (int)( ( $h7 >> 5 ) & 0xff ),
277
+            (int)( ( $h7 >> 13 ) & 0xff ),
278
+            (int)( ( ( $h7 >> 21 ) | ( $h8 << 4 ) ) & 0xff ),
279
+            (int)( ( $h8 >> 4 ) & 0xff ),
280
+            (int)( ( $h8 >> 12 ) & 0xff ),
281
+            (int)( ( ( $h8 >> 20 ) | ( $h9 << 6 ) ) & 0xff ),
282
+            (int)( ( $h9 >> 2 ) & 0xff ),
283
+            (int)( ( $h9 >> 10 ) & 0xff ),
284
+            (int)( ( $h9 >> 18 ) & 0xff )
285 285
         );
286
-        return self::intArrayToString($s);
286
+        return self::intArrayToString( $s );
287 287
     }
288 288
 
289 289
     /**
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
      * @throws SodiumException
297 297
      * @throws TypeError
298 298
      */
299
-    public static function fe_isnegative(ParagonIE_Sodium_Core_Curve25519_Fe $f)
299
+    public static function fe_isnegative( ParagonIE_Sodium_Core_Curve25519_Fe $f )
300 300
     {
301
-        $str = self::fe_tobytes($f);
302
-        return (int) (self::chrToInt($str[0]) & 1);
301
+        $str = self::fe_tobytes( $f );
302
+        return (int)( self::chrToInt( $str[ 0 ] ) & 1 );
303 303
     }
304 304
 
305 305
     /**
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
      * @throws SodiumException
313 313
      * @throws TypeError
314 314
      */
315
-    public static function fe_isnonzero(ParagonIE_Sodium_Core_Curve25519_Fe $f)
315
+    public static function fe_isnonzero( ParagonIE_Sodium_Core_Curve25519_Fe $f )
316 316
     {
317 317
         static $zero;
318
-        if ($zero === null) {
319
-            $zero = str_repeat("\x00", 32);
318
+        if ( $zero === null ) {
319
+            $zero = str_repeat( "\x00", 32 );
320 320
         }
321 321
         /** @var string $zero */
322 322
         /** @var string $str */
323
-        $str = self::fe_tobytes($f);
324
-        return !self::verify_32($str, (string) $zero);
323
+        $str = self::fe_tobytes( $f );
324
+        return ! self::verify_32( $str, (string)$zero );
325 325
     }
326 326
 
327 327
     /**
@@ -342,206 +342,206 @@  discard block
 block discarded – undo
342 342
         ParagonIE_Sodium_Core_Curve25519_Fe $f,
343 343
         ParagonIE_Sodium_Core_Curve25519_Fe $g
344 344
     ) {
345
-        $f0 = $f[0];
346
-        $f1 = $f[1];
347
-        $f2 = $f[2];
348
-        $f3 = $f[3];
349
-        $f4 = $f[4];
350
-        $f5 = $f[5];
351
-        $f6 = $f[6];
352
-        $f7 = $f[7];
353
-        $f8 = $f[8];
354
-        $f9 = $f[9];
355
-        $g0 = $g[0];
356
-        $g1 = $g[1];
357
-        $g2 = $g[2];
358
-        $g3 = $g[3];
359
-        $g4 = $g[4];
360
-        $g5 = $g[5];
361
-        $g6 = $g[6];
362
-        $g7 = $g[7];
363
-        $g8 = $g[8];
364
-        $g9 = $g[9];
365
-        $g1_19 = self::mul($g1, 19, 5);
366
-        $g2_19 = self::mul($g2, 19, 5);
367
-        $g3_19 = self::mul($g3, 19, 5);
368
-        $g4_19 = self::mul($g4, 19, 5);
369
-        $g5_19 = self::mul($g5, 19, 5);
370
-        $g6_19 = self::mul($g6, 19, 5);
371
-        $g7_19 = self::mul($g7, 19, 5);
372
-        $g8_19 = self::mul($g8, 19, 5);
373
-        $g9_19 = self::mul($g9, 19, 5);
345
+        $f0 = $f[ 0 ];
346
+        $f1 = $f[ 1 ];
347
+        $f2 = $f[ 2 ];
348
+        $f3 = $f[ 3 ];
349
+        $f4 = $f[ 4 ];
350
+        $f5 = $f[ 5 ];
351
+        $f6 = $f[ 6 ];
352
+        $f7 = $f[ 7 ];
353
+        $f8 = $f[ 8 ];
354
+        $f9 = $f[ 9 ];
355
+        $g0 = $g[ 0 ];
356
+        $g1 = $g[ 1 ];
357
+        $g2 = $g[ 2 ];
358
+        $g3 = $g[ 3 ];
359
+        $g4 = $g[ 4 ];
360
+        $g5 = $g[ 5 ];
361
+        $g6 = $g[ 6 ];
362
+        $g7 = $g[ 7 ];
363
+        $g8 = $g[ 8 ];
364
+        $g9 = $g[ 9 ];
365
+        $g1_19 = self::mul( $g1, 19, 5 );
366
+        $g2_19 = self::mul( $g2, 19, 5 );
367
+        $g3_19 = self::mul( $g3, 19, 5 );
368
+        $g4_19 = self::mul( $g4, 19, 5 );
369
+        $g5_19 = self::mul( $g5, 19, 5 );
370
+        $g6_19 = self::mul( $g6, 19, 5 );
371
+        $g7_19 = self::mul( $g7, 19, 5 );
372
+        $g8_19 = self::mul( $g8, 19, 5 );
373
+        $g9_19 = self::mul( $g9, 19, 5 );
374 374
         $f1_2 = $f1 << 1;
375 375
         $f3_2 = $f3 << 1;
376 376
         $f5_2 = $f5 << 1;
377 377
         $f7_2 = $f7 << 1;
378 378
         $f9_2 = $f9 << 1;
379
-        $f0g0    = self::mul($f0,    $g0, 26);
380
-        $f0g1    = self::mul($f0,    $g1, 25);
381
-        $f0g2    = self::mul($f0,    $g2, 26);
382
-        $f0g3    = self::mul($f0,    $g3, 25);
383
-        $f0g4    = self::mul($f0,    $g4, 26);
384
-        $f0g5    = self::mul($f0,    $g5, 25);
385
-        $f0g6    = self::mul($f0,    $g6, 26);
386
-        $f0g7    = self::mul($f0,    $g7, 25);
387
-        $f0g8    = self::mul($f0,    $g8, 26);
388
-        $f0g9    = self::mul($f0,    $g9, 26);
389
-        $f1g0    = self::mul($f1,    $g0, 26);
390
-        $f1g1_2  = self::mul($f1_2,  $g1, 25);
391
-        $f1g2    = self::mul($f1,    $g2, 26);
392
-        $f1g3_2  = self::mul($f1_2,  $g3, 25);
393
-        $f1g4    = self::mul($f1,    $g4, 26);
394
-        $f1g5_2  = self::mul($f1_2,  $g5, 25);
395
-        $f1g6    = self::mul($f1,    $g6, 26);
396
-        $f1g7_2  = self::mul($f1_2,  $g7, 25);
397
-        $f1g8    = self::mul($f1,    $g8, 26);
398
-        $f1g9_38 = self::mul($g9_19, $f1_2, 26);
399
-        $f2g0    = self::mul($f2,    $g0, 26);
400
-        $f2g1    = self::mul($f2,    $g1, 25);
401
-        $f2g2    = self::mul($f2,    $g2, 26);
402
-        $f2g3    = self::mul($f2,    $g3, 25);
403
-        $f2g4    = self::mul($f2,    $g4, 26);
404
-        $f2g5    = self::mul($f2,    $g5, 25);
405
-        $f2g6    = self::mul($f2,    $g6, 26);
406
-        $f2g7    = self::mul($f2,    $g7, 25);
407
-        $f2g8_19 = self::mul($g8_19, $f2, 26);
408
-        $f2g9_19 = self::mul($g9_19, $f2, 26);
409
-        $f3g0    = self::mul($f3,    $g0, 26);
410
-        $f3g1_2  = self::mul($f3_2,  $g1, 25);
411
-        $f3g2    = self::mul($f3,    $g2, 26);
412
-        $f3g3_2  = self::mul($f3_2,  $g3, 25);
413
-        $f3g4    = self::mul($f3,    $g4, 26);
414
-        $f3g5_2  = self::mul($f3_2,  $g5, 25);
415
-        $f3g6    = self::mul($f3,    $g6, 26);
416
-        $f3g7_38 = self::mul($g7_19, $f3_2, 26);
417
-        $f3g8_19 = self::mul($g8_19, $f3, 25);
418
-        $f3g9_38 = self::mul($g9_19, $f3_2, 26);
419
-        $f4g0    = self::mul($f4,    $g0, 26);
420
-        $f4g1    = self::mul($f4,    $g1, 25);
421
-        $f4g2    = self::mul($f4,    $g2, 26);
422
-        $f4g3    = self::mul($f4,    $g3, 25);
423
-        $f4g4    = self::mul($f4,    $g4, 26);
424
-        $f4g5    = self::mul($f4,    $g5, 25);
425
-        $f4g6_19 = self::mul($g6_19, $f4, 26);
426
-        $f4g7_19 = self::mul($g7_19, $f4, 26);
427
-        $f4g8_19 = self::mul($g8_19, $f4, 26);
428
-        $f4g9_19 = self::mul($g9_19, $f4, 26);
429
-        $f5g0    = self::mul($f5,    $g0, 26);
430
-        $f5g1_2  = self::mul($f5_2,  $g1, 25);
431
-        $f5g2    = self::mul($f5,    $g2, 26);
432
-        $f5g3_2  = self::mul($f5_2,  $g3, 25);
433
-        $f5g4    = self::mul($f5,    $g4, 26);
434
-        $f5g5_38 = self::mul($g5_19, $f5_2, 26);
435
-        $f5g6_19 = self::mul($g6_19, $f5, 25);
436
-        $f5g7_38 = self::mul($g7_19, $f5_2, 26);
437
-        $f5g8_19 = self::mul($g8_19, $f5, 25);
438
-        $f5g9_38 = self::mul($g9_19, $f5_2, 26);
439
-        $f6g0    = self::mul($f6,    $g0, 26);
440
-        $f6g1    = self::mul($f6,    $g1, 25);
441
-        $f6g2    = self::mul($f6,    $g2, 26);
442
-        $f6g3    = self::mul($f6,    $g3, 25);
443
-        $f6g4_19 = self::mul($g4_19, $f6, 26);
444
-        $f6g5_19 = self::mul($g5_19, $f6, 26);
445
-        $f6g6_19 = self::mul($g6_19, $f6, 26);
446
-        $f6g7_19 = self::mul($g7_19, $f6, 26);
447
-        $f6g8_19 = self::mul($g8_19, $f6, 26);
448
-        $f6g9_19 = self::mul($g9_19, $f6, 26);
449
-        $f7g0    = self::mul($f7,    $g0, 26);
450
-        $f7g1_2  = self::mul($f7_2,  $g1, 25);
451
-        $f7g2    = self::mul($f7,    $g2, 26);
452
-        $f7g3_38 = self::mul($g3_19, $f7_2, 26);
453
-        $f7g4_19 = self::mul($g4_19, $f7, 26);
454
-        $f7g5_38 = self::mul($g5_19, $f7_2, 26);
455
-        $f7g6_19 = self::mul($g6_19, $f7, 25);
456
-        $f7g7_38 = self::mul($g7_19, $f7_2, 26);
457
-        $f7g8_19 = self::mul($g8_19, $f7, 25);
458
-        $f7g9_38 = self::mul($g9_19,$f7_2, 26);
459
-        $f8g0    = self::mul($f8,    $g0, 26);
460
-        $f8g1    = self::mul($f8,    $g1, 25);
461
-        $f8g2_19 = self::mul($g2_19, $f8, 26);
462
-        $f8g3_19 = self::mul($g3_19, $f8, 26);
463
-        $f8g4_19 = self::mul($g4_19, $f8, 26);
464
-        $f8g5_19 = self::mul($g5_19, $f8, 26);
465
-        $f8g6_19 = self::mul($g6_19, $f8, 26);
466
-        $f8g7_19 = self::mul($g7_19, $f8, 26);
467
-        $f8g8_19 = self::mul($g8_19, $f8, 26);
468
-        $f8g9_19 = self::mul($g9_19, $f8, 26);
469
-        $f9g0    = self::mul($f9,    $g0, 26);
470
-        $f9g1_38 = self::mul($g1_19, $f9_2, 26);
471
-        $f9g2_19 = self::mul($g2_19, $f9, 25);
472
-        $f9g3_38 = self::mul($g3_19, $f9_2, 26);
473
-        $f9g4_19 = self::mul($g4_19, $f9, 25);
474
-        $f9g5_38 = self::mul($g5_19, $f9_2, 26);
475
-        $f9g6_19 = self::mul($g6_19, $f9, 25);
476
-        $f9g7_38 = self::mul($g7_19, $f9_2, 26);
477
-        $f9g8_19 = self::mul($g8_19, $f9, 25);
478
-        $f9g9_38 = self::mul($g9_19, $f9_2, 26);
379
+        $f0g0    = self::mul( $f0, $g0, 26 );
380
+        $f0g1    = self::mul( $f0, $g1, 25 );
381
+        $f0g2    = self::mul( $f0, $g2, 26 );
382
+        $f0g3    = self::mul( $f0, $g3, 25 );
383
+        $f0g4    = self::mul( $f0, $g4, 26 );
384
+        $f0g5    = self::mul( $f0, $g5, 25 );
385
+        $f0g6    = self::mul( $f0, $g6, 26 );
386
+        $f0g7    = self::mul( $f0, $g7, 25 );
387
+        $f0g8    = self::mul( $f0, $g8, 26 );
388
+        $f0g9    = self::mul( $f0, $g9, 26 );
389
+        $f1g0    = self::mul( $f1, $g0, 26 );
390
+        $f1g1_2  = self::mul( $f1_2, $g1, 25 );
391
+        $f1g2    = self::mul( $f1, $g2, 26 );
392
+        $f1g3_2  = self::mul( $f1_2, $g3, 25 );
393
+        $f1g4    = self::mul( $f1, $g4, 26 );
394
+        $f1g5_2  = self::mul( $f1_2, $g5, 25 );
395
+        $f1g6    = self::mul( $f1, $g6, 26 );
396
+        $f1g7_2  = self::mul( $f1_2, $g7, 25 );
397
+        $f1g8    = self::mul( $f1, $g8, 26 );
398
+        $f1g9_38 = self::mul( $g9_19, $f1_2, 26 );
399
+        $f2g0    = self::mul( $f2, $g0, 26 );
400
+        $f2g1    = self::mul( $f2, $g1, 25 );
401
+        $f2g2    = self::mul( $f2, $g2, 26 );
402
+        $f2g3    = self::mul( $f2, $g3, 25 );
403
+        $f2g4    = self::mul( $f2, $g4, 26 );
404
+        $f2g5    = self::mul( $f2, $g5, 25 );
405
+        $f2g6    = self::mul( $f2, $g6, 26 );
406
+        $f2g7    = self::mul( $f2, $g7, 25 );
407
+        $f2g8_19 = self::mul( $g8_19, $f2, 26 );
408
+        $f2g9_19 = self::mul( $g9_19, $f2, 26 );
409
+        $f3g0    = self::mul( $f3, $g0, 26 );
410
+        $f3g1_2  = self::mul( $f3_2, $g1, 25 );
411
+        $f3g2    = self::mul( $f3, $g2, 26 );
412
+        $f3g3_2  = self::mul( $f3_2, $g3, 25 );
413
+        $f3g4    = self::mul( $f3, $g4, 26 );
414
+        $f3g5_2  = self::mul( $f3_2, $g5, 25 );
415
+        $f3g6    = self::mul( $f3, $g6, 26 );
416
+        $f3g7_38 = self::mul( $g7_19, $f3_2, 26 );
417
+        $f3g8_19 = self::mul( $g8_19, $f3, 25 );
418
+        $f3g9_38 = self::mul( $g9_19, $f3_2, 26 );
419
+        $f4g0    = self::mul( $f4, $g0, 26 );
420
+        $f4g1    = self::mul( $f4, $g1, 25 );
421
+        $f4g2    = self::mul( $f4, $g2, 26 );
422
+        $f4g3    = self::mul( $f4, $g3, 25 );
423
+        $f4g4    = self::mul( $f4, $g4, 26 );
424
+        $f4g5    = self::mul( $f4, $g5, 25 );
425
+        $f4g6_19 = self::mul( $g6_19, $f4, 26 );
426
+        $f4g7_19 = self::mul( $g7_19, $f4, 26 );
427
+        $f4g8_19 = self::mul( $g8_19, $f4, 26 );
428
+        $f4g9_19 = self::mul( $g9_19, $f4, 26 );
429
+        $f5g0    = self::mul( $f5, $g0, 26 );
430
+        $f5g1_2  = self::mul( $f5_2, $g1, 25 );
431
+        $f5g2    = self::mul( $f5, $g2, 26 );
432
+        $f5g3_2  = self::mul( $f5_2, $g3, 25 );
433
+        $f5g4    = self::mul( $f5, $g4, 26 );
434
+        $f5g5_38 = self::mul( $g5_19, $f5_2, 26 );
435
+        $f5g6_19 = self::mul( $g6_19, $f5, 25 );
436
+        $f5g7_38 = self::mul( $g7_19, $f5_2, 26 );
437
+        $f5g8_19 = self::mul( $g8_19, $f5, 25 );
438
+        $f5g9_38 = self::mul( $g9_19, $f5_2, 26 );
439
+        $f6g0    = self::mul( $f6, $g0, 26 );
440
+        $f6g1    = self::mul( $f6, $g1, 25 );
441
+        $f6g2    = self::mul( $f6, $g2, 26 );
442
+        $f6g3    = self::mul( $f6, $g3, 25 );
443
+        $f6g4_19 = self::mul( $g4_19, $f6, 26 );
444
+        $f6g5_19 = self::mul( $g5_19, $f6, 26 );
445
+        $f6g6_19 = self::mul( $g6_19, $f6, 26 );
446
+        $f6g7_19 = self::mul( $g7_19, $f6, 26 );
447
+        $f6g8_19 = self::mul( $g8_19, $f6, 26 );
448
+        $f6g9_19 = self::mul( $g9_19, $f6, 26 );
449
+        $f7g0    = self::mul( $f7, $g0, 26 );
450
+        $f7g1_2  = self::mul( $f7_2, $g1, 25 );
451
+        $f7g2    = self::mul( $f7, $g2, 26 );
452
+        $f7g3_38 = self::mul( $g3_19, $f7_2, 26 );
453
+        $f7g4_19 = self::mul( $g4_19, $f7, 26 );
454
+        $f7g5_38 = self::mul( $g5_19, $f7_2, 26 );
455
+        $f7g6_19 = self::mul( $g6_19, $f7, 25 );
456
+        $f7g7_38 = self::mul( $g7_19, $f7_2, 26 );
457
+        $f7g8_19 = self::mul( $g8_19, $f7, 25 );
458
+        $f7g9_38 = self::mul( $g9_19, $f7_2, 26 );
459
+        $f8g0    = self::mul( $f8, $g0, 26 );
460
+        $f8g1    = self::mul( $f8, $g1, 25 );
461
+        $f8g2_19 = self::mul( $g2_19, $f8, 26 );
462
+        $f8g3_19 = self::mul( $g3_19, $f8, 26 );
463
+        $f8g4_19 = self::mul( $g4_19, $f8, 26 );
464
+        $f8g5_19 = self::mul( $g5_19, $f8, 26 );
465
+        $f8g6_19 = self::mul( $g6_19, $f8, 26 );
466
+        $f8g7_19 = self::mul( $g7_19, $f8, 26 );
467
+        $f8g8_19 = self::mul( $g8_19, $f8, 26 );
468
+        $f8g9_19 = self::mul( $g9_19, $f8, 26 );
469
+        $f9g0    = self::mul( $f9, $g0, 26 );
470
+        $f9g1_38 = self::mul( $g1_19, $f9_2, 26 );
471
+        $f9g2_19 = self::mul( $g2_19, $f9, 25 );
472
+        $f9g3_38 = self::mul( $g3_19, $f9_2, 26 );
473
+        $f9g4_19 = self::mul( $g4_19, $f9, 25 );
474
+        $f9g5_38 = self::mul( $g5_19, $f9_2, 26 );
475
+        $f9g6_19 = self::mul( $g6_19, $f9, 25 );
476
+        $f9g7_38 = self::mul( $g7_19, $f9_2, 26 );
477
+        $f9g8_19 = self::mul( $g8_19, $f9, 25 );
478
+        $f9g9_38 = self::mul( $g9_19, $f9_2, 26 );
479 479
         $h0 = $f0g0 + $f1g9_38 + $f2g8_19 + $f3g7_38 + $f4g6_19 + $f5g5_38 + $f6g4_19 + $f7g3_38 + $f8g2_19 + $f9g1_38;
480
-        $h1 = $f0g1 + $f1g0    + $f2g9_19 + $f3g8_19 + $f4g7_19 + $f5g6_19 + $f6g5_19 + $f7g4_19 + $f8g3_19 + $f9g2_19;
481
-        $h2 = $f0g2 + $f1g1_2  + $f2g0    + $f3g9_38 + $f4g8_19 + $f5g7_38 + $f6g6_19 + $f7g5_38 + $f8g4_19 + $f9g3_38;
482
-        $h3 = $f0g3 + $f1g2    + $f2g1    + $f3g0    + $f4g9_19 + $f5g8_19 + $f6g7_19 + $f7g6_19 + $f8g5_19 + $f9g4_19;
483
-        $h4 = $f0g4 + $f1g3_2  + $f2g2    + $f3g1_2  + $f4g0    + $f5g9_38 + $f6g8_19 + $f7g7_38 + $f8g6_19 + $f9g5_38;
484
-        $h5 = $f0g5 + $f1g4    + $f2g3    + $f3g2    + $f4g1    + $f5g0    + $f6g9_19 + $f7g8_19 + $f8g7_19 + $f9g6_19;
485
-        $h6 = $f0g6 + $f1g5_2  + $f2g4    + $f3g3_2  + $f4g2    + $f5g1_2  + $f6g0    + $f7g9_38 + $f8g8_19 + $f9g7_38;
486
-        $h7 = $f0g7 + $f1g6    + $f2g5    + $f3g4    + $f4g3    + $f5g2    + $f6g1    + $f7g0    + $f8g9_19 + $f9g8_19;
487
-        $h8 = $f0g8 + $f1g7_2  + $f2g6    + $f3g5_2  + $f4g4    + $f5g3_2  + $f6g2    + $f7g1_2  + $f8g0    + $f9g9_38;
488
-        $h9 = $f0g9 + $f1g8    + $f2g7    + $f3g6    + $f4g5    + $f5g4    + $f6g3    + $f7g2    + $f8g1    + $f9g0   ;
489
-
490
-        $carry0 = ($h0 + (1 << 25)) >> 26;
480
+        $h1 = $f0g1 + $f1g0 + $f2g9_19 + $f3g8_19 + $f4g7_19 + $f5g6_19 + $f6g5_19 + $f7g4_19 + $f8g3_19 + $f9g2_19;
481
+        $h2 = $f0g2 + $f1g1_2 + $f2g0 + $f3g9_38 + $f4g8_19 + $f5g7_38 + $f6g6_19 + $f7g5_38 + $f8g4_19 + $f9g3_38;
482
+        $h3 = $f0g3 + $f1g2 + $f2g1 + $f3g0 + $f4g9_19 + $f5g8_19 + $f6g7_19 + $f7g6_19 + $f8g5_19 + $f9g4_19;
483
+        $h4 = $f0g4 + $f1g3_2 + $f2g2 + $f3g1_2 + $f4g0 + $f5g9_38 + $f6g8_19 + $f7g7_38 + $f8g6_19 + $f9g5_38;
484
+        $h5 = $f0g5 + $f1g4 + $f2g3 + $f3g2 + $f4g1 + $f5g0 + $f6g9_19 + $f7g8_19 + $f8g7_19 + $f9g6_19;
485
+        $h6 = $f0g6 + $f1g5_2 + $f2g4 + $f3g3_2 + $f4g2 + $f5g1_2 + $f6g0 + $f7g9_38 + $f8g8_19 + $f9g7_38;
486
+        $h7 = $f0g7 + $f1g6 + $f2g5 + $f3g4 + $f4g3 + $f5g2 + $f6g1 + $f7g0 + $f8g9_19 + $f9g8_19;
487
+        $h8 = $f0g8 + $f1g7_2 + $f2g6 + $f3g5_2 + $f4g4 + $f5g3_2 + $f6g2 + $f7g1_2 + $f8g0 + $f9g9_38;
488
+        $h9 = $f0g9 + $f1g8 + $f2g7 + $f3g6 + $f4g5 + $f5g4 + $f6g3 + $f7g2 + $f8g1 + $f9g0;
489
+
490
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
491 491
         $h1 += $carry0;
492 492
         $h0 -= $carry0 << 26;
493
-        $carry4 = ($h4 + (1 << 25)) >> 26;
493
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
494 494
         $h5 += $carry4;
495 495
         $h4 -= $carry4 << 26;
496 496
 
497
-        $carry1 = ($h1 + (1 << 24)) >> 25;
497
+        $carry1 = ( $h1 + ( 1 << 24 ) ) >> 25;
498 498
         $h2 += $carry1;
499 499
         $h1 -= $carry1 << 25;
500
-        $carry5 = ($h5 + (1 << 24)) >> 25;
500
+        $carry5 = ( $h5 + ( 1 << 24 ) ) >> 25;
501 501
         $h6 += $carry5;
502 502
         $h5 -= $carry5 << 25;
503 503
 
504
-        $carry2 = ($h2 + (1 << 25)) >> 26;
504
+        $carry2 = ( $h2 + ( 1 << 25 ) ) >> 26;
505 505
         $h3 += $carry2;
506 506
         $h2 -= $carry2 << 26;
507
-        $carry6 = ($h6 + (1 << 25)) >> 26;
507
+        $carry6 = ( $h6 + ( 1 << 25 ) ) >> 26;
508 508
         $h7 += $carry6;
509 509
         $h6 -= $carry6 << 26;
510 510
 
511
-        $carry3 = ($h3 + (1 << 24)) >> 25;
511
+        $carry3 = ( $h3 + ( 1 << 24 ) ) >> 25;
512 512
         $h4 += $carry3;
513 513
         $h3 -= $carry3 << 25;
514
-        $carry7 = ($h7 + (1 << 24)) >> 25;
514
+        $carry7 = ( $h7 + ( 1 << 24 ) ) >> 25;
515 515
         $h8 += $carry7;
516 516
         $h7 -= $carry7 << 25;
517 517
 
518
-        $carry4 = ($h4 + (1 << 25)) >> 26;
518
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
519 519
         $h5 += $carry4;
520 520
         $h4 -= $carry4 << 26;
521
-        $carry8 = ($h8 + (1 << 25)) >> 26;
521
+        $carry8 = ( $h8 + ( 1 << 25 ) ) >> 26;
522 522
         $h9 += $carry8;
523 523
         $h8 -= $carry8 << 26;
524 524
 
525
-        $carry9 = ($h9 + (1 << 24)) >> 25;
526
-        $h0 += self::mul($carry9, 19, 5);
525
+        $carry9 = ( $h9 + ( 1 << 24 ) ) >> 25;
526
+        $h0 += self::mul( $carry9, 19, 5 );
527 527
         $h9 -= $carry9 << 25;
528 528
 
529
-        $carry0 = ($h0 + (1 << 25)) >> 26;
529
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
530 530
         $h1 += $carry0;
531 531
         $h0 -= $carry0 << 26;
532 532
 
533 533
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
534 534
             array(
535
-                (int) $h0,
536
-                (int) $h1,
537
-                (int) $h2,
538
-                (int) $h3,
539
-                (int) $h4,
540
-                (int) $h5,
541
-                (int) $h6,
542
-                (int) $h7,
543
-                (int) $h8,
544
-                (int) $h9
535
+                (int)$h0,
536
+                (int)$h1,
537
+                (int)$h2,
538
+                (int)$h3,
539
+                (int)$h4,
540
+                (int)$h5,
541
+                (int)$h6,
542
+                (int)$h7,
543
+                (int)$h8,
544
+                (int)$h9
545 545
             )
546 546
         );
547 547
     }
@@ -557,11 +557,11 @@  discard block
 block discarded – undo
557 557
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
558 558
      * @psalm-suppress MixedAssignment
559 559
      */
560
-    public static function fe_neg(ParagonIE_Sodium_Core_Curve25519_Fe $f)
560
+    public static function fe_neg( ParagonIE_Sodium_Core_Curve25519_Fe $f )
561 561
     {
562 562
         $h = new ParagonIE_Sodium_Core_Curve25519_Fe();
563
-        for ($i = 0; $i < 10; ++$i) {
564
-            $h[$i] = -$f[$i];
563
+        for ( $i = 0; $i < 10; ++$i ) {
564
+            $h[ $i ] = -$f[ $i ];
565 565
         }
566 566
         return $h;
567 567
     }
@@ -576,18 +576,18 @@  discard block
 block discarded – undo
576 576
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $f
577 577
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
578 578
      */
579
-    public static function fe_sq(ParagonIE_Sodium_Core_Curve25519_Fe $f)
579
+    public static function fe_sq( ParagonIE_Sodium_Core_Curve25519_Fe $f )
580 580
     {
581
-        $f0 = (int) $f[0];
582
-        $f1 = (int) $f[1];
583
-        $f2 = (int) $f[2];
584
-        $f3 = (int) $f[3];
585
-        $f4 = (int) $f[4];
586
-        $f5 = (int) $f[5];
587
-        $f6 = (int) $f[6];
588
-        $f7 = (int) $f[7];
589
-        $f8 = (int) $f[8];
590
-        $f9 = (int) $f[9];
581
+        $f0 = (int)$f[ 0 ];
582
+        $f1 = (int)$f[ 1 ];
583
+        $f2 = (int)$f[ 2 ];
584
+        $f3 = (int)$f[ 3 ];
585
+        $f4 = (int)$f[ 4 ];
586
+        $f5 = (int)$f[ 5 ];
587
+        $f6 = (int)$f[ 6 ];
588
+        $f7 = (int)$f[ 7 ];
589
+        $f8 = (int)$f[ 8 ];
590
+        $f9 = (int)$f[ 9 ];
591 591
 
592 592
         $f0_2 = $f0 << 1;
593 593
         $f1_2 = $f1 << 1;
@@ -597,132 +597,132 @@  discard block
 block discarded – undo
597 597
         $f5_2 = $f5 << 1;
598 598
         $f6_2 = $f6 << 1;
599 599
         $f7_2 = $f7 << 1;
600
-        $f5_38 = self::mul($f5, 38, 6);
601
-        $f6_19 = self::mul($f6, 19, 5);
602
-        $f7_38 = self::mul($f7, 38, 6);
603
-        $f8_19 = self::mul($f8, 19, 5);
604
-        $f9_38 = self::mul($f9, 38, 6);
605
-        $f0f0    = self::mul($f0,    $f0,    26);
606
-        $f0f1_2  = self::mul($f0_2,  $f1,    26);
607
-        $f0f2_2  = self::mul($f0_2,  $f2,    26);
608
-        $f0f3_2  = self::mul($f0_2,  $f3,    26);
609
-        $f0f4_2  = self::mul($f0_2,  $f4,    26);
610
-        $f0f5_2  = self::mul($f0_2,  $f5,    26);
611
-        $f0f6_2  = self::mul($f0_2,  $f6,    26);
612
-        $f0f7_2  = self::mul($f0_2,  $f7,    26);
613
-        $f0f8_2  = self::mul($f0_2,  $f8,    26);
614
-        $f0f9_2  = self::mul($f0_2,  $f9,    26);
615
-        $f1f1_2  = self::mul($f1_2,  $f1,    26);
616
-        $f1f2_2  = self::mul($f1_2,  $f2,    26);
617
-        $f1f3_4  = self::mul($f1_2,  $f3_2,  26);
618
-        $f1f4_2  = self::mul($f1_2,  $f4,    26);
619
-        $f1f5_4  = self::mul($f1_2,  $f5_2,  26);
620
-        $f1f6_2  = self::mul($f1_2,  $f6,    26);
621
-        $f1f7_4  = self::mul($f1_2,  $f7_2,  26);
622
-        $f1f8_2  = self::mul($f1_2,  $f8,    26);
623
-        $f1f9_76 = self::mul($f9_38, $f1_2,  27);
624
-        $f2f2    = self::mul($f2,    $f2,    27);
625
-        $f2f3_2  = self::mul($f2_2,  $f3,    27);
626
-        $f2f4_2  = self::mul($f2_2,  $f4,    27);
627
-        $f2f5_2  = self::mul($f2_2,  $f5,    27);
628
-        $f2f6_2  = self::mul($f2_2,  $f6,    27);
629
-        $f2f7_2  = self::mul($f2_2,  $f7,    27);
630
-        $f2f8_38 = self::mul($f8_19, $f2_2,  27);
631
-        $f2f9_38 = self::mul($f9_38, $f2,    26);
632
-        $f3f3_2  = self::mul($f3_2,  $f3,    26);
633
-        $f3f4_2  = self::mul($f3_2,  $f4,    26);
634
-        $f3f5_4  = self::mul($f3_2,  $f5_2,  26);
635
-        $f3f6_2  = self::mul($f3_2,  $f6,    26);
636
-        $f3f7_76 = self::mul($f7_38, $f3_2,  26);
637
-        $f3f8_38 = self::mul($f8_19, $f3_2,  26);
638
-        $f3f9_76 = self::mul($f9_38, $f3_2,  26);
639
-        $f4f4    = self::mul($f4,    $f4,    26);
640
-        $f4f5_2  = self::mul($f4_2,  $f5,    26);
641
-        $f4f6_38 = self::mul($f6_19, $f4_2,  27);
642
-        $f4f7_38 = self::mul($f7_38, $f4,    26);
643
-        $f4f8_38 = self::mul($f8_19, $f4_2,  27);
644
-        $f4f9_38 = self::mul($f9_38, $f4,    26);
645
-        $f5f5_38 = self::mul($f5_38, $f5,    26);
646
-        $f5f6_38 = self::mul($f6_19, $f5_2,  26);
647
-        $f5f7_76 = self::mul($f7_38, $f5_2,  26);
648
-        $f5f8_38 = self::mul($f8_19, $f5_2,  26);
649
-        $f5f9_76 = self::mul($f9_38, $f5_2,  26);
650
-        $f6f6_19 = self::mul($f6_19, $f6,    26);
651
-        $f6f7_38 = self::mul($f7_38, $f6,    26);
652
-        $f6f8_38 = self::mul($f8_19, $f6_2,  27);
653
-        $f6f9_38 = self::mul($f9_38, $f6,    26);
654
-        $f7f7_38 = self::mul($f7_38, $f7,    26);
655
-        $f7f8_38 = self::mul($f8_19, $f7_2,  26);
656
-        $f7f9_76 = self::mul($f9_38, $f7_2,  26);
657
-        $f8f8_19 = self::mul($f8_19, $f8,    26);
658
-        $f8f9_38 = self::mul($f9_38, $f8,    26);
659
-        $f9f9_38 = self::mul($f9_38, $f9,    26);
660
-        $h0 = $f0f0   + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38;
600
+        $f5_38 = self::mul( $f5, 38, 6 );
601
+        $f6_19 = self::mul( $f6, 19, 5 );
602
+        $f7_38 = self::mul( $f7, 38, 6 );
603
+        $f8_19 = self::mul( $f8, 19, 5 );
604
+        $f9_38 = self::mul( $f9, 38, 6 );
605
+        $f0f0    = self::mul( $f0, $f0, 26 );
606
+        $f0f1_2  = self::mul( $f0_2, $f1, 26 );
607
+        $f0f2_2  = self::mul( $f0_2, $f2, 26 );
608
+        $f0f3_2  = self::mul( $f0_2, $f3, 26 );
609
+        $f0f4_2  = self::mul( $f0_2, $f4, 26 );
610
+        $f0f5_2  = self::mul( $f0_2, $f5, 26 );
611
+        $f0f6_2  = self::mul( $f0_2, $f6, 26 );
612
+        $f0f7_2  = self::mul( $f0_2, $f7, 26 );
613
+        $f0f8_2  = self::mul( $f0_2, $f8, 26 );
614
+        $f0f9_2  = self::mul( $f0_2, $f9, 26 );
615
+        $f1f1_2  = self::mul( $f1_2, $f1, 26 );
616
+        $f1f2_2  = self::mul( $f1_2, $f2, 26 );
617
+        $f1f3_4  = self::mul( $f1_2, $f3_2, 26 );
618
+        $f1f4_2  = self::mul( $f1_2, $f4, 26 );
619
+        $f1f5_4  = self::mul( $f1_2, $f5_2, 26 );
620
+        $f1f6_2  = self::mul( $f1_2, $f6, 26 );
621
+        $f1f7_4  = self::mul( $f1_2, $f7_2, 26 );
622
+        $f1f8_2  = self::mul( $f1_2, $f8, 26 );
623
+        $f1f9_76 = self::mul( $f9_38, $f1_2, 27 );
624
+        $f2f2    = self::mul( $f2, $f2, 27 );
625
+        $f2f3_2  = self::mul( $f2_2, $f3, 27 );
626
+        $f2f4_2  = self::mul( $f2_2, $f4, 27 );
627
+        $f2f5_2  = self::mul( $f2_2, $f5, 27 );
628
+        $f2f6_2  = self::mul( $f2_2, $f6, 27 );
629
+        $f2f7_2  = self::mul( $f2_2, $f7, 27 );
630
+        $f2f8_38 = self::mul( $f8_19, $f2_2, 27 );
631
+        $f2f9_38 = self::mul( $f9_38, $f2, 26 );
632
+        $f3f3_2  = self::mul( $f3_2, $f3, 26 );
633
+        $f3f4_2  = self::mul( $f3_2, $f4, 26 );
634
+        $f3f5_4  = self::mul( $f3_2, $f5_2, 26 );
635
+        $f3f6_2  = self::mul( $f3_2, $f6, 26 );
636
+        $f3f7_76 = self::mul( $f7_38, $f3_2, 26 );
637
+        $f3f8_38 = self::mul( $f8_19, $f3_2, 26 );
638
+        $f3f9_76 = self::mul( $f9_38, $f3_2, 26 );
639
+        $f4f4    = self::mul( $f4, $f4, 26 );
640
+        $f4f5_2  = self::mul( $f4_2, $f5, 26 );
641
+        $f4f6_38 = self::mul( $f6_19, $f4_2, 27 );
642
+        $f4f7_38 = self::mul( $f7_38, $f4, 26 );
643
+        $f4f8_38 = self::mul( $f8_19, $f4_2, 27 );
644
+        $f4f9_38 = self::mul( $f9_38, $f4, 26 );
645
+        $f5f5_38 = self::mul( $f5_38, $f5, 26 );
646
+        $f5f6_38 = self::mul( $f6_19, $f5_2, 26 );
647
+        $f5f7_76 = self::mul( $f7_38, $f5_2, 26 );
648
+        $f5f8_38 = self::mul( $f8_19, $f5_2, 26 );
649
+        $f5f9_76 = self::mul( $f9_38, $f5_2, 26 );
650
+        $f6f6_19 = self::mul( $f6_19, $f6, 26 );
651
+        $f6f7_38 = self::mul( $f7_38, $f6, 26 );
652
+        $f6f8_38 = self::mul( $f8_19, $f6_2, 27 );
653
+        $f6f9_38 = self::mul( $f9_38, $f6, 26 );
654
+        $f7f7_38 = self::mul( $f7_38, $f7, 26 );
655
+        $f7f8_38 = self::mul( $f8_19, $f7_2, 26 );
656
+        $f7f9_76 = self::mul( $f9_38, $f7_2, 26 );
657
+        $f8f8_19 = self::mul( $f8_19, $f8, 26 );
658
+        $f8f9_38 = self::mul( $f9_38, $f8, 26 );
659
+        $f9f9_38 = self::mul( $f9_38, $f9, 26 );
660
+        $h0 = $f0f0 + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38;
661 661
         $h1 = $f0f1_2 + $f2f9_38 + $f3f8_38 + $f4f7_38 + $f5f6_38;
662
-        $h2 = $f0f2_2 + $f1f1_2  + $f3f9_76 + $f4f8_38 + $f5f7_76 + $f6f6_19;
663
-        $h3 = $f0f3_2 + $f1f2_2  + $f4f9_38 + $f5f8_38 + $f6f7_38;
664
-        $h4 = $f0f4_2 + $f1f3_4  + $f2f2    + $f5f9_76 + $f6f8_38 + $f7f7_38;
665
-        $h5 = $f0f5_2 + $f1f4_2  + $f2f3_2  + $f6f9_38 + $f7f8_38;
666
-        $h6 = $f0f6_2 + $f1f5_4  + $f2f4_2  + $f3f3_2  + $f7f9_76 + $f8f8_19;
667
-        $h7 = $f0f7_2 + $f1f6_2  + $f2f5_2  + $f3f4_2  + $f8f9_38;
668
-        $h8 = $f0f8_2 + $f1f7_4  + $f2f6_2  + $f3f5_4  + $f4f4    + $f9f9_38;
669
-        $h9 = $f0f9_2 + $f1f8_2  + $f2f7_2  + $f3f6_2  + $f4f5_2;
670
-
671
-        $carry0 = ($h0 + (1 << 25)) >> 26;
662
+        $h2 = $f0f2_2 + $f1f1_2 + $f3f9_76 + $f4f8_38 + $f5f7_76 + $f6f6_19;
663
+        $h3 = $f0f3_2 + $f1f2_2 + $f4f9_38 + $f5f8_38 + $f6f7_38;
664
+        $h4 = $f0f4_2 + $f1f3_4 + $f2f2 + $f5f9_76 + $f6f8_38 + $f7f7_38;
665
+        $h5 = $f0f5_2 + $f1f4_2 + $f2f3_2 + $f6f9_38 + $f7f8_38;
666
+        $h6 = $f0f6_2 + $f1f5_4 + $f2f4_2 + $f3f3_2 + $f7f9_76 + $f8f8_19;
667
+        $h7 = $f0f7_2 + $f1f6_2 + $f2f5_2 + $f3f4_2 + $f8f9_38;
668
+        $h8 = $f0f8_2 + $f1f7_4 + $f2f6_2 + $f3f5_4 + $f4f4 + $f9f9_38;
669
+        $h9 = $f0f9_2 + $f1f8_2 + $f2f7_2 + $f3f6_2 + $f4f5_2;
670
+
671
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
672 672
         $h1 += $carry0;
673 673
         $h0 -= $carry0 << 26;
674
-        $carry4 = ($h4 + (1 << 25)) >> 26;
674
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
675 675
         $h5 += $carry4;
676 676
         $h4 -= $carry4 << 26;
677 677
 
678
-        $carry1 = ($h1 + (1 << 24)) >> 25;
678
+        $carry1 = ( $h1 + ( 1 << 24 ) ) >> 25;
679 679
         $h2 += $carry1;
680 680
         $h1 -= $carry1 << 25;
681
-        $carry5 = ($h5 + (1 << 24)) >> 25;
681
+        $carry5 = ( $h5 + ( 1 << 24 ) ) >> 25;
682 682
         $h6 += $carry5;
683 683
         $h5 -= $carry5 << 25;
684 684
 
685
-        $carry2 = ($h2 + (1 << 25)) >> 26;
685
+        $carry2 = ( $h2 + ( 1 << 25 ) ) >> 26;
686 686
         $h3 += $carry2;
687 687
         $h2 -= $carry2 << 26;
688
-        $carry6 = ($h6 + (1 << 25)) >> 26;
688
+        $carry6 = ( $h6 + ( 1 << 25 ) ) >> 26;
689 689
         $h7 += $carry6;
690 690
         $h6 -= $carry6 << 26;
691 691
 
692
-        $carry3 = ($h3 + (1 << 24)) >> 25;
692
+        $carry3 = ( $h3 + ( 1 << 24 ) ) >> 25;
693 693
         $h4 += $carry3;
694 694
         $h3 -= $carry3 << 25;
695
-        $carry7 = ($h7 + (1 << 24)) >> 25;
695
+        $carry7 = ( $h7 + ( 1 << 24 ) ) >> 25;
696 696
         $h8 += $carry7;
697 697
         $h7 -= $carry7 << 25;
698 698
 
699
-        $carry4 = ($h4 + (1 << 25)) >> 26;
699
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
700 700
         $h5 += $carry4;
701 701
         $h4 -= $carry4 << 26;
702
-        $carry8 = ($h8 + (1 << 25)) >> 26;
702
+        $carry8 = ( $h8 + ( 1 << 25 ) ) >> 26;
703 703
         $h9 += $carry8;
704 704
         $h8 -= $carry8 << 26;
705 705
 
706
-        $carry9 = ($h9 + (1 << 24)) >> 25;
707
-        $h0 += self::mul($carry9, 19, 5);
706
+        $carry9 = ( $h9 + ( 1 << 24 ) ) >> 25;
707
+        $h0 += self::mul( $carry9, 19, 5 );
708 708
         $h9 -= $carry9 << 25;
709 709
 
710
-        $carry0 = ($h0 + (1 << 25)) >> 26;
710
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
711 711
         $h1 += $carry0;
712 712
         $h0 -= $carry0 << 26;
713 713
 
714 714
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
715 715
             array(
716
-                (int) $h0,
717
-                (int) $h1,
718
-                (int) $h2,
719
-                (int) $h3,
720
-                (int) $h4,
721
-                (int) $h5,
722
-                (int) $h6,
723
-                (int) $h7,
724
-                (int) $h8,
725
-                (int) $h9
716
+                (int)$h0,
717
+                (int)$h1,
718
+                (int)$h2,
719
+                (int)$h3,
720
+                (int)$h4,
721
+                (int)$h5,
722
+                (int)$h6,
723
+                (int)$h7,
724
+                (int)$h8,
725
+                (int)$h9
726 726
             )
727 727
         );
728 728
     }
@@ -738,18 +738,18 @@  discard block
 block discarded – undo
738 738
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $f
739 739
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
740 740
      */
741
-    public static function fe_sq2(ParagonIE_Sodium_Core_Curve25519_Fe $f)
741
+    public static function fe_sq2( ParagonIE_Sodium_Core_Curve25519_Fe $f )
742 742
     {
743
-        $f0 = (int) $f[0];
744
-        $f1 = (int) $f[1];
745
-        $f2 = (int) $f[2];
746
-        $f3 = (int) $f[3];
747
-        $f4 = (int) $f[4];
748
-        $f5 = (int) $f[5];
749
-        $f6 = (int) $f[6];
750
-        $f7 = (int) $f[7];
751
-        $f8 = (int) $f[8];
752
-        $f9 = (int) $f[9];
743
+        $f0 = (int)$f[ 0 ];
744
+        $f1 = (int)$f[ 1 ];
745
+        $f2 = (int)$f[ 2 ];
746
+        $f3 = (int)$f[ 3 ];
747
+        $f4 = (int)$f[ 4 ];
748
+        $f5 = (int)$f[ 5 ];
749
+        $f6 = (int)$f[ 6 ];
750
+        $f7 = (int)$f[ 7 ];
751
+        $f8 = (int)$f[ 8 ];
752
+        $f9 = (int)$f[ 9 ];
753 753
 
754 754
         $f0_2 = $f0 << 1;
755 755
         $f1_2 = $f1 << 1;
@@ -759,133 +759,133 @@  discard block
 block discarded – undo
759 759
         $f5_2 = $f5 << 1;
760 760
         $f6_2 = $f6 << 1;
761 761
         $f7_2 = $f7 << 1;
762
-        $f5_38 = self::mul($f5, 38, 6); /* 1.959375*2^30 */
763
-        $f6_19 = self::mul($f6, 19, 5); /* 1.959375*2^30 */
764
-        $f7_38 = self::mul($f7, 38, 6); /* 1.959375*2^30 */
765
-        $f8_19 = self::mul($f8, 19, 5); /* 1.959375*2^30 */
766
-        $f9_38 = self::mul($f9, 38, 6); /* 1.959375*2^30 */
767
-        $f0f0 = self::mul($f0, $f0, 24);
768
-        $f0f1_2 = self::mul($f0_2, $f1, 24);
769
-        $f0f2_2 = self::mul($f0_2, $f2, 24);
770
-        $f0f3_2 = self::mul($f0_2, $f3, 24);
771
-        $f0f4_2 = self::mul($f0_2, $f4, 24);
772
-        $f0f5_2 = self::mul($f0_2, $f5, 24);
773
-        $f0f6_2 = self::mul($f0_2, $f6, 24);
774
-        $f0f7_2 = self::mul($f0_2, $f7, 24);
775
-        $f0f8_2 = self::mul($f0_2, $f8, 24);
776
-        $f0f9_2 = self::mul($f0_2, $f9, 24);
777
-        $f1f1_2 = self::mul($f1_2,  $f1, 24);
778
-        $f1f2_2 = self::mul($f1_2,  $f2, 24);
779
-        $f1f3_4 = self::mul($f1_2,  $f3_2, 24);
780
-        $f1f4_2 = self::mul($f1_2,  $f4, 24);
781
-        $f1f5_4 = self::mul($f1_2,  $f5_2, 24);
782
-        $f1f6_2 = self::mul($f1_2,  $f6, 24);
783
-        $f1f7_4 = self::mul($f1_2,  $f7_2, 24);
784
-        $f1f8_2 = self::mul($f1_2,  $f8, 24);
785
-        $f1f9_76 = self::mul($f9_38, $f1_2, 24);
786
-        $f2f2 = self::mul($f2,  $f2, 24);
787
-        $f2f3_2 = self::mul($f2_2,  $f3, 24);
788
-        $f2f4_2 = self::mul($f2_2,  $f4, 24);
789
-        $f2f5_2 = self::mul($f2_2,  $f5, 24);
790
-        $f2f6_2 = self::mul($f2_2,  $f6, 24);
791
-        $f2f7_2 = self::mul($f2_2,  $f7, 24);
792
-        $f2f8_38 = self::mul($f8_19, $f2_2, 25);
793
-        $f2f9_38 = self::mul($f9_38, $f2, 24);
794
-        $f3f3_2 = self::mul($f3_2,  $f3, 24);
795
-        $f3f4_2 = self::mul($f3_2,  $f4, 24);
796
-        $f3f5_4 = self::mul($f3_2,  $f5_2, 24);
797
-        $f3f6_2 = self::mul($f3_2,  $f6, 24);
798
-        $f3f7_76 = self::mul($f7_38, $f3_2, 24);
799
-        $f3f8_38 = self::mul($f8_19, $f3_2, 24);
800
-        $f3f9_76 = self::mul($f9_38, $f3_2, 24);
801
-        $f4f4 = self::mul($f4,  $f4, 24);
802
-        $f4f5_2 = self::mul($f4_2,  $f5, 24);
803
-        $f4f6_38 = self::mul($f6_19, $f4_2, 25);
804
-        $f4f7_38 = self::mul($f7_38, $f4, 24);
805
-        $f4f8_38 = self::mul($f8_19, $f4_2, 25);
806
-        $f4f9_38 = self::mul($f9_38, $f4, 24);
807
-        $f5f5_38 = self::mul($f5_38, $f5, 24);
808
-        $f5f6_38 = self::mul($f6_19, $f5_2, 24);
809
-        $f5f7_76 = self::mul($f7_38, $f5_2, 24);
810
-        $f5f8_38 = self::mul($f8_19, $f5_2, 24);
811
-        $f5f9_76 = self::mul($f9_38, $f5_2, 24);
812
-        $f6f6_19 = self::mul($f6_19, $f6, 24);
813
-        $f6f7_38 = self::mul($f7_38, $f6, 24);
814
-        $f6f8_38 = self::mul($f8_19, $f6_2, 25);
815
-        $f6f9_38 = self::mul($f9_38, $f6, 24);
816
-        $f7f7_38 = self::mul($f7_38, $f7, 24);
817
-        $f7f8_38 = self::mul($f8_19, $f7_2, 24);
818
-        $f7f9_76 = self::mul($f9_38, $f7_2, 24);
819
-        $f8f8_19 = self::mul($f8_19, $f8, 24);
820
-        $f8f9_38 = self::mul($f9_38, $f8, 24);
821
-        $f9f9_38 = self::mul($f9_38, $f9, 24);
822
-
823
-        $h0 = (int) ($f0f0 + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38) << 1;
824
-        $h1 = (int) ($f0f1_2 + $f2f9_38 + $f3f8_38 + $f4f7_38 + $f5f6_38) << 1;
825
-        $h2 = (int) ($f0f2_2 + $f1f1_2  + $f3f9_76 + $f4f8_38 + $f5f7_76 + $f6f6_19) << 1;
826
-        $h3 = (int) ($f0f3_2 + $f1f2_2  + $f4f9_38 + $f5f8_38 + $f6f7_38) << 1;
827
-        $h4 = (int) ($f0f4_2 + $f1f3_4  + $f2f2    + $f5f9_76 + $f6f8_38 + $f7f7_38) << 1;
828
-        $h5 = (int) ($f0f5_2 + $f1f4_2  + $f2f3_2  + $f6f9_38 + $f7f8_38) << 1;
829
-        $h6 = (int) ($f0f6_2 + $f1f5_4  + $f2f4_2  + $f3f3_2  + $f7f9_76 + $f8f8_19) << 1;
830
-        $h7 = (int) ($f0f7_2 + $f1f6_2  + $f2f5_2  + $f3f4_2  + $f8f9_38) << 1;
831
-        $h8 = (int) ($f0f8_2 + $f1f7_4  + $f2f6_2  + $f3f5_4  + $f4f4    + $f9f9_38) << 1;
832
-        $h9 = (int) ($f0f9_2 + $f1f8_2  + $f2f7_2  + $f3f6_2  + $f4f5_2) << 1;
833
-
834
-        $carry0 = ($h0 + (1 << 25)) >> 26;
762
+        $f5_38 = self::mul( $f5, 38, 6 ); /* 1.959375*2^30 */
763
+        $f6_19 = self::mul( $f6, 19, 5 ); /* 1.959375*2^30 */
764
+        $f7_38 = self::mul( $f7, 38, 6 ); /* 1.959375*2^30 */
765
+        $f8_19 = self::mul( $f8, 19, 5 ); /* 1.959375*2^30 */
766
+        $f9_38 = self::mul( $f9, 38, 6 ); /* 1.959375*2^30 */
767
+        $f0f0 = self::mul( $f0, $f0, 24 );
768
+        $f0f1_2 = self::mul( $f0_2, $f1, 24 );
769
+        $f0f2_2 = self::mul( $f0_2, $f2, 24 );
770
+        $f0f3_2 = self::mul( $f0_2, $f3, 24 );
771
+        $f0f4_2 = self::mul( $f0_2, $f4, 24 );
772
+        $f0f5_2 = self::mul( $f0_2, $f5, 24 );
773
+        $f0f6_2 = self::mul( $f0_2, $f6, 24 );
774
+        $f0f7_2 = self::mul( $f0_2, $f7, 24 );
775
+        $f0f8_2 = self::mul( $f0_2, $f8, 24 );
776
+        $f0f9_2 = self::mul( $f0_2, $f9, 24 );
777
+        $f1f1_2 = self::mul( $f1_2, $f1, 24 );
778
+        $f1f2_2 = self::mul( $f1_2, $f2, 24 );
779
+        $f1f3_4 = self::mul( $f1_2, $f3_2, 24 );
780
+        $f1f4_2 = self::mul( $f1_2, $f4, 24 );
781
+        $f1f5_4 = self::mul( $f1_2, $f5_2, 24 );
782
+        $f1f6_2 = self::mul( $f1_2, $f6, 24 );
783
+        $f1f7_4 = self::mul( $f1_2, $f7_2, 24 );
784
+        $f1f8_2 = self::mul( $f1_2, $f8, 24 );
785
+        $f1f9_76 = self::mul( $f9_38, $f1_2, 24 );
786
+        $f2f2 = self::mul( $f2, $f2, 24 );
787
+        $f2f3_2 = self::mul( $f2_2, $f3, 24 );
788
+        $f2f4_2 = self::mul( $f2_2, $f4, 24 );
789
+        $f2f5_2 = self::mul( $f2_2, $f5, 24 );
790
+        $f2f6_2 = self::mul( $f2_2, $f6, 24 );
791
+        $f2f7_2 = self::mul( $f2_2, $f7, 24 );
792
+        $f2f8_38 = self::mul( $f8_19, $f2_2, 25 );
793
+        $f2f9_38 = self::mul( $f9_38, $f2, 24 );
794
+        $f3f3_2 = self::mul( $f3_2, $f3, 24 );
795
+        $f3f4_2 = self::mul( $f3_2, $f4, 24 );
796
+        $f3f5_4 = self::mul( $f3_2, $f5_2, 24 );
797
+        $f3f6_2 = self::mul( $f3_2, $f6, 24 );
798
+        $f3f7_76 = self::mul( $f7_38, $f3_2, 24 );
799
+        $f3f8_38 = self::mul( $f8_19, $f3_2, 24 );
800
+        $f3f9_76 = self::mul( $f9_38, $f3_2, 24 );
801
+        $f4f4 = self::mul( $f4, $f4, 24 );
802
+        $f4f5_2 = self::mul( $f4_2, $f5, 24 );
803
+        $f4f6_38 = self::mul( $f6_19, $f4_2, 25 );
804
+        $f4f7_38 = self::mul( $f7_38, $f4, 24 );
805
+        $f4f8_38 = self::mul( $f8_19, $f4_2, 25 );
806
+        $f4f9_38 = self::mul( $f9_38, $f4, 24 );
807
+        $f5f5_38 = self::mul( $f5_38, $f5, 24 );
808
+        $f5f6_38 = self::mul( $f6_19, $f5_2, 24 );
809
+        $f5f7_76 = self::mul( $f7_38, $f5_2, 24 );
810
+        $f5f8_38 = self::mul( $f8_19, $f5_2, 24 );
811
+        $f5f9_76 = self::mul( $f9_38, $f5_2, 24 );
812
+        $f6f6_19 = self::mul( $f6_19, $f6, 24 );
813
+        $f6f7_38 = self::mul( $f7_38, $f6, 24 );
814
+        $f6f8_38 = self::mul( $f8_19, $f6_2, 25 );
815
+        $f6f9_38 = self::mul( $f9_38, $f6, 24 );
816
+        $f7f7_38 = self::mul( $f7_38, $f7, 24 );
817
+        $f7f8_38 = self::mul( $f8_19, $f7_2, 24 );
818
+        $f7f9_76 = self::mul( $f9_38, $f7_2, 24 );
819
+        $f8f8_19 = self::mul( $f8_19, $f8, 24 );
820
+        $f8f9_38 = self::mul( $f9_38, $f8, 24 );
821
+        $f9f9_38 = self::mul( $f9_38, $f9, 24 );
822
+
823
+        $h0 = (int)( $f0f0 + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38 ) << 1;
824
+        $h1 = (int)( $f0f1_2 + $f2f9_38 + $f3f8_38 + $f4f7_38 + $f5f6_38 ) << 1;
825
+        $h2 = (int)( $f0f2_2 + $f1f1_2 + $f3f9_76 + $f4f8_38 + $f5f7_76 + $f6f6_19 ) << 1;
826
+        $h3 = (int)( $f0f3_2 + $f1f2_2 + $f4f9_38 + $f5f8_38 + $f6f7_38 ) << 1;
827
+        $h4 = (int)( $f0f4_2 + $f1f3_4 + $f2f2 + $f5f9_76 + $f6f8_38 + $f7f7_38 ) << 1;
828
+        $h5 = (int)( $f0f5_2 + $f1f4_2 + $f2f3_2 + $f6f9_38 + $f7f8_38 ) << 1;
829
+        $h6 = (int)( $f0f6_2 + $f1f5_4 + $f2f4_2 + $f3f3_2 + $f7f9_76 + $f8f8_19 ) << 1;
830
+        $h7 = (int)( $f0f7_2 + $f1f6_2 + $f2f5_2 + $f3f4_2 + $f8f9_38 ) << 1;
831
+        $h8 = (int)( $f0f8_2 + $f1f7_4 + $f2f6_2 + $f3f5_4 + $f4f4 + $f9f9_38 ) << 1;
832
+        $h9 = (int)( $f0f9_2 + $f1f8_2 + $f2f7_2 + $f3f6_2 + $f4f5_2 ) << 1;
833
+
834
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
835 835
         $h1 += $carry0;
836 836
         $h0 -= $carry0 << 26;
837
-        $carry4 = ($h4 + (1 << 25)) >> 26;
837
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
838 838
         $h5 += $carry4;
839 839
         $h4 -= $carry4 << 26;
840 840
 
841
-        $carry1 = ($h1 + (1 << 24)) >> 25;
841
+        $carry1 = ( $h1 + ( 1 << 24 ) ) >> 25;
842 842
         $h2 += $carry1;
843 843
         $h1 -= $carry1 << 25;
844
-        $carry5 = ($h5 + (1 << 24)) >> 25;
844
+        $carry5 = ( $h5 + ( 1 << 24 ) ) >> 25;
845 845
         $h6 += $carry5;
846 846
         $h5 -= $carry5 << 25;
847 847
 
848
-        $carry2 = ($h2 + (1 << 25)) >> 26;
848
+        $carry2 = ( $h2 + ( 1 << 25 ) ) >> 26;
849 849
         $h3 += $carry2;
850 850
         $h2 -= $carry2 << 26;
851
-        $carry6 = ($h6 + (1 << 25)) >> 26;
851
+        $carry6 = ( $h6 + ( 1 << 25 ) ) >> 26;
852 852
         $h7 += $carry6;
853 853
         $h6 -= $carry6 << 26;
854 854
 
855
-        $carry3 = ($h3 + (1 << 24)) >> 25;
855
+        $carry3 = ( $h3 + ( 1 << 24 ) ) >> 25;
856 856
         $h4 += $carry3;
857 857
         $h3 -= $carry3 << 25;
858
-        $carry7 = ($h7 + (1 << 24)) >> 25;
858
+        $carry7 = ( $h7 + ( 1 << 24 ) ) >> 25;
859 859
         $h8 += $carry7;
860 860
         $h7 -= $carry7 << 25;
861 861
 
862
-        $carry4 = ($h4 + (1 << 25)) >> 26;
862
+        $carry4 = ( $h4 + ( 1 << 25 ) ) >> 26;
863 863
         $h5 += $carry4;
864 864
         $h4 -= $carry4 << 26;
865
-        $carry8 = ($h8 + (1 << 25)) >> 26;
865
+        $carry8 = ( $h8 + ( 1 << 25 ) ) >> 26;
866 866
         $h9 += $carry8;
867 867
         $h8 -= $carry8 << 26;
868 868
 
869
-        $carry9 = ($h9 + (1 << 24)) >> 25;
870
-        $h0 += self::mul($carry9, 19, 5);
869
+        $carry9 = ( $h9 + ( 1 << 24 ) ) >> 25;
870
+        $h0 += self::mul( $carry9, 19, 5 );
871 871
         $h9 -= $carry9 << 25;
872 872
 
873
-        $carry0 = ($h0 + (1 << 25)) >> 26;
873
+        $carry0 = ( $h0 + ( 1 << 25 ) ) >> 26;
874 874
         $h1 += $carry0;
875 875
         $h0 -= $carry0 << 26;
876 876
 
877 877
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
878 878
             array(
879
-                (int) $h0,
880
-                (int) $h1,
881
-                (int) $h2,
882
-                (int) $h3,
883
-                (int) $h4,
884
-                (int) $h5,
885
-                (int) $h6,
886
-                (int) $h7,
887
-                (int) $h8,
888
-                (int) $h9
879
+                (int)$h0,
880
+                (int)$h1,
881
+                (int)$h2,
882
+                (int)$h3,
883
+                (int)$h4,
884
+                (int)$h5,
885
+                (int)$h6,
886
+                (int)$h7,
887
+                (int)$h8,
888
+                (int)$h9
889 889
             )
890 890
         );
891 891
     }
@@ -896,56 +896,56 @@  discard block
 block discarded – undo
896 896
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $Z
897 897
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
898 898
      */
899
-    public static function fe_invert(ParagonIE_Sodium_Core_Curve25519_Fe $Z)
899
+    public static function fe_invert( ParagonIE_Sodium_Core_Curve25519_Fe $Z )
900 900
     {
901 901
         $z = clone $Z;
902
-        $t0 = self::fe_sq($z);
903
-        $t1 = self::fe_sq($t0);
904
-        $t1 = self::fe_sq($t1);
905
-        $t1 = self::fe_mul($z, $t1);
906
-        $t0 = self::fe_mul($t0, $t1);
907
-        $t2 = self::fe_sq($t0);
908
-        $t1 = self::fe_mul($t1, $t2);
909
-        $t2 = self::fe_sq($t1);
910
-        for ($i = 1; $i < 5; ++$i) {
911
-            $t2 = self::fe_sq($t2);
902
+        $t0 = self::fe_sq( $z );
903
+        $t1 = self::fe_sq( $t0 );
904
+        $t1 = self::fe_sq( $t1 );
905
+        $t1 = self::fe_mul( $z, $t1 );
906
+        $t0 = self::fe_mul( $t0, $t1 );
907
+        $t2 = self::fe_sq( $t0 );
908
+        $t1 = self::fe_mul( $t1, $t2 );
909
+        $t2 = self::fe_sq( $t1 );
910
+        for ( $i = 1; $i < 5; ++$i ) {
911
+            $t2 = self::fe_sq( $t2 );
912 912
         }
913
-        $t1 = self::fe_mul($t2, $t1);
914
-        $t2 = self::fe_sq($t1);
915
-        for ($i = 1; $i < 10; ++$i) {
916
-            $t2 = self::fe_sq($t2);
913
+        $t1 = self::fe_mul( $t2, $t1 );
914
+        $t2 = self::fe_sq( $t1 );
915
+        for ( $i = 1; $i < 10; ++$i ) {
916
+            $t2 = self::fe_sq( $t2 );
917 917
         }
918
-        $t2 = self::fe_mul($t2, $t1);
919
-        $t3 = self::fe_sq($t2);
920
-        for ($i = 1; $i < 20; ++$i) {
921
-            $t3 = self::fe_sq($t3);
918
+        $t2 = self::fe_mul( $t2, $t1 );
919
+        $t3 = self::fe_sq( $t2 );
920
+        for ( $i = 1; $i < 20; ++$i ) {
921
+            $t3 = self::fe_sq( $t3 );
922 922
         }
923
-        $t2 = self::fe_mul($t3, $t2);
924
-        $t2 = self::fe_sq($t2);
925
-        for ($i = 1; $i < 10; ++$i) {
926
-            $t2 = self::fe_sq($t2);
923
+        $t2 = self::fe_mul( $t3, $t2 );
924
+        $t2 = self::fe_sq( $t2 );
925
+        for ( $i = 1; $i < 10; ++$i ) {
926
+            $t2 = self::fe_sq( $t2 );
927 927
         }
928
-        $t1 = self::fe_mul($t2, $t1);
929
-        $t2 = self::fe_sq($t1);
930
-        for ($i = 1; $i < 50; ++$i) {
931
-            $t2 = self::fe_sq($t2);
928
+        $t1 = self::fe_mul( $t2, $t1 );
929
+        $t2 = self::fe_sq( $t1 );
930
+        for ( $i = 1; $i < 50; ++$i ) {
931
+            $t2 = self::fe_sq( $t2 );
932 932
         }
933
-        $t2 = self::fe_mul($t2, $t1);
934
-        $t3 = self::fe_sq($t2);
935
-        for ($i = 1; $i < 100; ++$i) {
936
-            $t3 = self::fe_sq($t3);
933
+        $t2 = self::fe_mul( $t2, $t1 );
934
+        $t3 = self::fe_sq( $t2 );
935
+        for ( $i = 1; $i < 100; ++$i ) {
936
+            $t3 = self::fe_sq( $t3 );
937 937
         }
938
-        $t2 = self::fe_mul($t3, $t2);
939
-        $t2 = self::fe_sq($t2);
940
-        for ($i = 1; $i < 50; ++$i) {
941
-            $t2 = self::fe_sq($t2);
938
+        $t2 = self::fe_mul( $t3, $t2 );
939
+        $t2 = self::fe_sq( $t2 );
940
+        for ( $i = 1; $i < 50; ++$i ) {
941
+            $t2 = self::fe_sq( $t2 );
942 942
         }
943
-        $t1 = self::fe_mul($t2, $t1);
944
-        $t1 = self::fe_sq($t1);
945
-        for ($i = 1; $i < 5; ++$i) {
946
-            $t1 = self::fe_sq($t1);
943
+        $t1 = self::fe_mul( $t2, $t1 );
944
+        $t1 = self::fe_sq( $t1 );
945
+        for ( $i = 1; $i < 5; ++$i ) {
946
+            $t1 = self::fe_sq( $t1 );
947 947
         }
948
-        return self::fe_mul($t1, $t0);
948
+        return self::fe_mul( $t1, $t0 );
949 949
     }
950 950
 
951 951
     /**
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
      * @param ParagonIE_Sodium_Core_Curve25519_Fe $z
957 957
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
958 958
      */
959
-    public static function fe_pow22523(ParagonIE_Sodium_Core_Curve25519_Fe $z)
959
+    public static function fe_pow22523( ParagonIE_Sodium_Core_Curve25519_Fe $z )
960 960
     {
961 961
         # fe_sq(t0, z);
962 962
         # fe_sq(t1, t0);
@@ -966,102 +966,102 @@  discard block
 block discarded – undo
966 966
         # fe_sq(t0, t0);
967 967
         # fe_mul(t0, t1, t0);
968 968
         # fe_sq(t1, t0);
969
-        $t0 = self::fe_sq($z);
970
-        $t1 = self::fe_sq($t0);
971
-        $t1 = self::fe_sq($t1);
972
-        $t1 = self::fe_mul($z, $t1);
973
-        $t0 = self::fe_mul($t0, $t1);
974
-        $t0 = self::fe_sq($t0);
975
-        $t0 = self::fe_mul($t1, $t0);
976
-        $t1 = self::fe_sq($t0);
969
+        $t0 = self::fe_sq( $z );
970
+        $t1 = self::fe_sq( $t0 );
971
+        $t1 = self::fe_sq( $t1 );
972
+        $t1 = self::fe_mul( $z, $t1 );
973
+        $t0 = self::fe_mul( $t0, $t1 );
974
+        $t0 = self::fe_sq( $t0 );
975
+        $t0 = self::fe_mul( $t1, $t0 );
976
+        $t1 = self::fe_sq( $t0 );
977 977
 
978 978
         # for (i = 1; i < 5; ++i) {
979 979
         #     fe_sq(t1, t1);
980 980
         # }
981
-        for ($i = 1; $i < 5; ++$i) {
982
-            $t1 = self::fe_sq($t1);
981
+        for ( $i = 1; $i < 5; ++$i ) {
982
+            $t1 = self::fe_sq( $t1 );
983 983
         }
984 984
 
985 985
         # fe_mul(t0, t1, t0);
986 986
         # fe_sq(t1, t0);
987
-        $t0 = self::fe_mul($t1, $t0);
988
-        $t1 = self::fe_sq($t0);
987
+        $t0 = self::fe_mul( $t1, $t0 );
988
+        $t1 = self::fe_sq( $t0 );
989 989
 
990 990
         # for (i = 1; i < 10; ++i) {
991 991
         #     fe_sq(t1, t1);
992 992
         # }
993
-        for ($i = 1; $i < 10; ++$i) {
994
-            $t1 = self::fe_sq($t1);
993
+        for ( $i = 1; $i < 10; ++$i ) {
994
+            $t1 = self::fe_sq( $t1 );
995 995
         }
996 996
 
997 997
         # fe_mul(t1, t1, t0);
998 998
         # fe_sq(t2, t1);
999
-        $t1 = self::fe_mul($t1, $t0);
1000
-        $t2 = self::fe_sq($t1);
999
+        $t1 = self::fe_mul( $t1, $t0 );
1000
+        $t2 = self::fe_sq( $t1 );
1001 1001
 
1002 1002
         # for (i = 1; i < 20; ++i) {
1003 1003
         #     fe_sq(t2, t2);
1004 1004
         # }
1005
-        for ($i = 1; $i < 20; ++$i) {
1006
-            $t2 = self::fe_sq($t2);
1005
+        for ( $i = 1; $i < 20; ++$i ) {
1006
+            $t2 = self::fe_sq( $t2 );
1007 1007
         }
1008 1008
 
1009 1009
         # fe_mul(t1, t2, t1);
1010 1010
         # fe_sq(t1, t1);
1011
-        $t1 = self::fe_mul($t2, $t1);
1012
-        $t1 = self::fe_sq($t1);
1011
+        $t1 = self::fe_mul( $t2, $t1 );
1012
+        $t1 = self::fe_sq( $t1 );
1013 1013
 
1014 1014
         # for (i = 1; i < 10; ++i) {
1015 1015
         #     fe_sq(t1, t1);
1016 1016
         # }
1017
-        for ($i = 1; $i < 10; ++$i) {
1018
-            $t1 = self::fe_sq($t1);
1017
+        for ( $i = 1; $i < 10; ++$i ) {
1018
+            $t1 = self::fe_sq( $t1 );
1019 1019
         }
1020 1020
 
1021 1021
         # fe_mul(t0, t1, t0);
1022 1022
         # fe_sq(t1, t0);
1023
-        $t0 = self::fe_mul($t1, $t0);
1024
-        $t1 = self::fe_sq($t0);
1023
+        $t0 = self::fe_mul( $t1, $t0 );
1024
+        $t1 = self::fe_sq( $t0 );
1025 1025
 
1026 1026
         # for (i = 1; i < 50; ++i) {
1027 1027
         #     fe_sq(t1, t1);
1028 1028
         # }
1029
-        for ($i = 1; $i < 50; ++$i) {
1030
-            $t1 = self::fe_sq($t1);
1029
+        for ( $i = 1; $i < 50; ++$i ) {
1030
+            $t1 = self::fe_sq( $t1 );
1031 1031
         }
1032 1032
 
1033 1033
         # fe_mul(t1, t1, t0);
1034 1034
         # fe_sq(t2, t1);
1035
-        $t1 = self::fe_mul($t1, $t0);
1036
-        $t2 = self::fe_sq($t1);
1035
+        $t1 = self::fe_mul( $t1, $t0 );
1036
+        $t2 = self::fe_sq( $t1 );
1037 1037
 
1038 1038
         # for (i = 1; i < 100; ++i) {
1039 1039
         #     fe_sq(t2, t2);
1040 1040
         # }
1041
-        for ($i = 1; $i < 100; ++$i) {
1042
-            $t2 = self::fe_sq($t2);
1041
+        for ( $i = 1; $i < 100; ++$i ) {
1042
+            $t2 = self::fe_sq( $t2 );
1043 1043
         }
1044 1044
 
1045 1045
         # fe_mul(t1, t2, t1);
1046 1046
         # fe_sq(t1, t1);
1047
-        $t1 = self::fe_mul($t2, $t1);
1048
-        $t1 = self::fe_sq($t1);
1047
+        $t1 = self::fe_mul( $t2, $t1 );
1048
+        $t1 = self::fe_sq( $t1 );
1049 1049
 
1050 1050
         # for (i = 1; i < 50; ++i) {
1051 1051
         #     fe_sq(t1, t1);
1052 1052
         # }
1053
-        for ($i = 1; $i < 50; ++$i) {
1054
-            $t1 = self::fe_sq($t1);
1053
+        for ( $i = 1; $i < 50; ++$i ) {
1054
+            $t1 = self::fe_sq( $t1 );
1055 1055
         }
1056 1056
 
1057 1057
         # fe_mul(t0, t1, t0);
1058 1058
         # fe_sq(t0, t0);
1059 1059
         # fe_sq(t0, t0);
1060 1060
         # fe_mul(out, t0, z);
1061
-        $t0 = self::fe_mul($t1, $t0);
1062
-        $t0 = self::fe_sq($t0);
1063
-        $t0 = self::fe_sq($t0);
1064
-        return self::fe_mul($t0, $z);
1061
+        $t0 = self::fe_mul( $t1, $t0 );
1062
+        $t0 = self::fe_sq( $t0 );
1063
+        $t0 = self::fe_sq( $t0 );
1064
+        return self::fe_mul( $t0, $z );
1065 1065
     }
1066 1066
 
1067 1067
     /**
@@ -1083,20 +1083,20 @@  discard block
 block discarded – undo
1083 1083
      * @return ParagonIE_Sodium_Core_Curve25519_Fe
1084 1084
      * @psalm-suppress MixedOperand
1085 1085
      */
1086
-    public static function fe_sub(ParagonIE_Sodium_Core_Curve25519_Fe $f, ParagonIE_Sodium_Core_Curve25519_Fe $g)
1086
+    public static function fe_sub( ParagonIE_Sodium_Core_Curve25519_Fe $f, ParagonIE_Sodium_Core_Curve25519_Fe $g )
1087 1087
     {
1088 1088
         return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(
1089 1089
             array(
1090
-                (int) ($f[0] - $g[0]),
1091
-                (int) ($f[1] - $g[1]),
1092
-                (int) ($f[2] - $g[2]),
1093
-                (int) ($f[3] - $g[3]),
1094
-                (int) ($f[4] - $g[4]),
1095
-                (int) ($f[5] - $g[5]),
1096
-                (int) ($f[6] - $g[6]),
1097
-                (int) ($f[7] - $g[7]),
1098
-                (int) ($f[8] - $g[8]),
1099
-                (int) ($f[9] - $g[9])
1090
+                (int)( $f[ 0 ] - $g[ 0 ] ),
1091
+                (int)( $f[ 1 ] - $g[ 1 ] ),
1092
+                (int)( $f[ 2 ] - $g[ 2 ] ),
1093
+                (int)( $f[ 3 ] - $g[ 3 ] ),
1094
+                (int)( $f[ 4 ] - $g[ 4 ] ),
1095
+                (int)( $f[ 5 ] - $g[ 5 ] ),
1096
+                (int)( $f[ 6 ] - $g[ 6 ] ),
1097
+                (int)( $f[ 7 ] - $g[ 7 ] ),
1098
+                (int)( $f[ 8 ] - $g[ 8 ] ),
1099
+                (int)( $f[ 9 ] - $g[ 9 ] )
1100 1100
             )
1101 1101
         );
1102 1102
     }
@@ -1117,17 +1117,17 @@  discard block
 block discarded – undo
1117 1117
         ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q
1118 1118
     ) {
1119 1119
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P1p1();
1120
-        $r->X = self::fe_add($p->Y, $p->X);
1121
-        $r->Y = self::fe_sub($p->Y, $p->X);
1122
-        $r->Z = self::fe_mul($r->X, $q->YplusX);
1123
-        $r->Y = self::fe_mul($r->Y, $q->YminusX);
1124
-        $r->T = self::fe_mul($q->T2d, $p->T);
1125
-        $r->X = self::fe_mul($p->Z, $q->Z);
1126
-        $t0   = self::fe_add($r->X, $r->X);
1127
-        $r->X = self::fe_sub($r->Z, $r->Y);
1128
-        $r->Y = self::fe_add($r->Z, $r->Y);
1129
-        $r->Z = self::fe_add($t0, $r->T);
1130
-        $r->T = self::fe_sub($t0, $r->T);
1120
+        $r->X = self::fe_add( $p->Y, $p->X );
1121
+        $r->Y = self::fe_sub( $p->Y, $p->X );
1122
+        $r->Z = self::fe_mul( $r->X, $q->YplusX );
1123
+        $r->Y = self::fe_mul( $r->Y, $q->YminusX );
1124
+        $r->T = self::fe_mul( $q->T2d, $p->T );
1125
+        $r->X = self::fe_mul( $p->Z, $q->Z );
1126
+        $t0   = self::fe_add( $r->X, $r->X );
1127
+        $r->X = self::fe_sub( $r->Z, $r->Y );
1128
+        $r->Y = self::fe_add( $r->Z, $r->Y );
1129
+        $r->Z = self::fe_add( $t0, $r->T );
1130
+        $r->T = self::fe_sub( $t0, $r->T );
1131 1131
         return $r;
1132 1132
     }
1133 1133
 
@@ -1140,42 +1140,42 @@  discard block
 block discarded – undo
1140 1140
      * @throws SodiumException
1141 1141
      * @throws TypeError
1142 1142
      */
1143
-    public static function slide($a)
1143
+    public static function slide( $a )
1144 1144
     {
1145
-        if (self::strlen($a) < 256) {
1146
-            if (self::strlen($a) < 16) {
1147
-                $a = str_pad($a, 256, '0', STR_PAD_RIGHT);
1145
+        if ( self::strlen( $a ) < 256 ) {
1146
+            if ( self::strlen( $a ) < 16 ) {
1147
+                $a = str_pad( $a, 256, '0', STR_PAD_RIGHT );
1148 1148
             }
1149 1149
         }
1150 1150
         /** @var array<int, int> $r */
1151 1151
         $r = array();
1152 1152
 
1153 1153
         /** @var int $i */
1154
-        for ($i = 0; $i < 256; ++$i) {
1155
-            $r[$i] = (int) (
1154
+        for ( $i = 0; $i < 256; ++$i ) {
1155
+            $r[ $i ] = (int)(
1156 1156
                 1 & (
1157
-                    self::chrToInt($a[(int) ($i >> 3)])
1157
+                    self::chrToInt( $a[ (int)( $i >> 3 ) ] )
1158 1158
                         >>
1159
-                    ($i & 7)
1159
+                    ( $i & 7 )
1160 1160
                 )
1161 1161
             );
1162 1162
         }
1163 1163
 
1164
-        for ($i = 0;$i < 256;++$i) {
1165
-            if ($r[$i]) {
1166
-                for ($b = 1;$b <= 6 && $i + $b < 256;++$b) {
1167
-                    if ($r[$i + $b]) {
1168
-                        if ($r[$i] + ($r[$i + $b] << $b) <= 15) {
1169
-                            $r[$i] += $r[$i + $b] << $b;
1170
-                            $r[$i + $b] = 0;
1171
-                        } elseif ($r[$i] - ($r[$i + $b] << $b) >= -15) {
1172
-                            $r[$i] -= $r[$i + $b] << $b;
1173
-                            for ($k = $i + $b; $k < 256; ++$k) {
1174
-                                if (!$r[$k]) {
1175
-                                    $r[$k] = 1;
1164
+        for ( $i = 0; $i < 256; ++$i ) {
1165
+            if ( $r[ $i ] ) {
1166
+                for ( $b = 1; $b <= 6 && $i + $b < 256; ++$b ) {
1167
+                    if ( $r[ $i + $b ] ) {
1168
+                        if ( $r[ $i ] + ( $r[ $i + $b ] << $b ) <= 15 ) {
1169
+                            $r[ $i ] += $r[ $i + $b ] << $b;
1170
+                            $r[ $i + $b ] = 0;
1171
+                        } elseif ( $r[ $i ] - ( $r[ $i + $b ] << $b ) >= -15 ) {
1172
+                            $r[ $i ] -= $r[ $i + $b ] << $b;
1173
+                            for ( $k = $i + $b; $k < 256; ++$k ) {
1174
+                                if ( ! $r[ $k ] ) {
1175
+                                    $r[ $k ] = 1;
1176 1176
                                     break;
1177 1177
                                 }
1178
-                                $r[$k] = 0;
1178
+                                $r[ $k ] = 0;
1179 1179
                             }
1180 1180
                         } else {
1181 1181
                             break;
@@ -1195,18 +1195,18 @@  discard block
 block discarded – undo
1195 1195
      * @throws SodiumException
1196 1196
      * @throws TypeError
1197 1197
      */
1198
-    public static function ge_frombytes_negate_vartime($s)
1198
+    public static function ge_frombytes_negate_vartime( $s )
1199 1199
     {
1200 1200
         static $d = null;
1201
-        if (!$d) {
1202
-            $d = ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$d);
1201
+        if ( ! $d ) {
1202
+            $d = ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$d );
1203 1203
         }
1204 1204
 
1205 1205
         # fe_frombytes(h->Y,s);
1206 1206
         # fe_1(h->Z);
1207 1207
         $h = new ParagonIE_Sodium_Core_Curve25519_Ge_P3(
1208 1208
             self::fe_0(),
1209
-            self::fe_frombytes($s),
1209
+            self::fe_frombytes( $s ),
1210 1210
             self::fe_1()
1211 1211
         );
1212 1212
 
@@ -1214,36 +1214,36 @@  discard block
 block discarded – undo
1214 1214
         # fe_mul(v,u,d);
1215 1215
         # fe_sub(u,u,h->Z);       /* u = y^2-1 */
1216 1216
         # fe_add(v,v,h->Z);       /* v = dy^2+1 */
1217
-        $u = self::fe_sq($h->Y);
1217
+        $u = self::fe_sq( $h->Y );
1218 1218
         /** @var ParagonIE_Sodium_Core_Curve25519_Fe $d */
1219
-        $v = self::fe_mul($u, $d);
1220
-        $u = self::fe_sub($u, $h->Z); /* u =  y^2 - 1 */
1221
-        $v = self::fe_add($v, $h->Z); /* v = dy^2 + 1 */
1219
+        $v = self::fe_mul( $u, $d );
1220
+        $u = self::fe_sub( $u, $h->Z ); /* u =  y^2 - 1 */
1221
+        $v = self::fe_add( $v, $h->Z ); /* v = dy^2 + 1 */
1222 1222
 
1223 1223
         # fe_sq(v3,v);
1224 1224
         # fe_mul(v3,v3,v);        /* v3 = v^3 */
1225 1225
         # fe_sq(h->X,v3);
1226 1226
         # fe_mul(h->X,h->X,v);
1227 1227
         # fe_mul(h->X,h->X,u);    /* x = uv^7 */
1228
-        $v3 = self::fe_sq($v);
1229
-        $v3 = self::fe_mul($v3, $v); /* v3 = v^3 */
1230
-        $h->X = self::fe_sq($v3);
1231
-        $h->X = self::fe_mul($h->X, $v);
1232
-        $h->X = self::fe_mul($h->X, $u); /* x = uv^7 */
1228
+        $v3 = self::fe_sq( $v );
1229
+        $v3 = self::fe_mul( $v3, $v ); /* v3 = v^3 */
1230
+        $h->X = self::fe_sq( $v3 );
1231
+        $h->X = self::fe_mul( $h->X, $v );
1232
+        $h->X = self::fe_mul( $h->X, $u ); /* x = uv^7 */
1233 1233
 
1234 1234
         # fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
1235 1235
         # fe_mul(h->X,h->X,v3);
1236 1236
         # fe_mul(h->X,h->X,u);    /* x = uv^3(uv^7)^((q-5)/8) */
1237
-        $h->X = self::fe_pow22523($h->X); /* x = (uv^7)^((q-5)/8) */
1238
-        $h->X = self::fe_mul($h->X, $v3);
1239
-        $h->X = self::fe_mul($h->X, $u); /* x = uv^3(uv^7)^((q-5)/8) */
1237
+        $h->X = self::fe_pow22523( $h->X ); /* x = (uv^7)^((q-5)/8) */
1238
+        $h->X = self::fe_mul( $h->X, $v3 );
1239
+        $h->X = self::fe_mul( $h->X, $u ); /* x = uv^3(uv^7)^((q-5)/8) */
1240 1240
 
1241 1241
         # fe_sq(vxx,h->X);
1242 1242
         # fe_mul(vxx,vxx,v);
1243 1243
         # fe_sub(check,vxx,u);    /* vx^2-u */
1244
-        $vxx = self::fe_sq($h->X);
1245
-        $vxx = self::fe_mul($vxx, $v);
1246
-        $check = self::fe_sub($vxx, $u); /* vx^2 - u */
1244
+        $vxx = self::fe_sq( $h->X );
1245
+        $vxx = self::fe_mul( $vxx, $v );
1246
+        $check = self::fe_sub( $vxx, $u ); /* vx^2 - u */
1247 1247
 
1248 1248
         # if (fe_isnonzero(check)) {
1249 1249
         #     fe_add(check,vxx,u);  /* vx^2+u */
@@ -1252,27 +1252,27 @@  discard block
 block discarded – undo
1252 1252
         #     }
1253 1253
         #     fe_mul(h->X,h->X,sqrtm1);
1254 1254
         # }
1255
-        if (self::fe_isnonzero($check)) {
1256
-            $check = self::fe_add($vxx, $u); /* vx^2 + u */
1257
-            if (self::fe_isnonzero($check)) {
1258
-                throw new RangeException('Internal check failed.');
1255
+        if ( self::fe_isnonzero( $check ) ) {
1256
+            $check = self::fe_add( $vxx, $u ); /* vx^2 + u */
1257
+            if ( self::fe_isnonzero( $check ) ) {
1258
+                throw new RangeException( 'Internal check failed.' );
1259 1259
             }
1260 1260
             $h->X = self::fe_mul(
1261 1261
                 $h->X,
1262
-                ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$sqrtm1)
1262
+                ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$sqrtm1 )
1263 1263
             );
1264 1264
         }
1265 1265
 
1266 1266
         # if (fe_isnegative(h->X) == (s[31] >> 7)) {
1267 1267
         #     fe_neg(h->X,h->X);
1268 1268
         # }
1269
-        $i = self::chrToInt($s[31]);
1270
-        if (self::fe_isnegative($h->X) === ($i >> 7)) {
1271
-            $h->X = self::fe_neg($h->X);
1269
+        $i = self::chrToInt( $s[ 31 ] );
1270
+        if ( self::fe_isnegative( $h->X ) === ( $i >> 7 ) ) {
1271
+            $h->X = self::fe_neg( $h->X );
1272 1272
         }
1273 1273
 
1274 1274
         # fe_mul(h->T,h->X,h->Y);
1275
-        $h->T = self::fe_mul($h->X, $h->Y);
1275
+        $h->T = self::fe_mul( $h->X, $h->Y );
1276 1276
         return $h;
1277 1277
     }
1278 1278
 
@@ -1290,16 +1290,16 @@  discard block
 block discarded – undo
1290 1290
         ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $q
1291 1291
     ) {
1292 1292
         $r = clone $R;
1293
-        $r->X = self::fe_add($p->Y, $p->X);
1294
-        $r->Y = self::fe_sub($p->Y, $p->X);
1295
-        $r->Z = self::fe_mul($r->X, $q->yplusx);
1296
-        $r->Y = self::fe_mul($r->Y, $q->yminusx);
1297
-        $r->T = self::fe_mul($q->xy2d, $p->T);
1298
-        $t0 = self::fe_add(clone $p->Z, clone $p->Z);
1299
-        $r->X = self::fe_sub($r->Z, $r->Y);
1300
-        $r->Y = self::fe_add($r->Z, $r->Y);
1301
-        $r->Z = self::fe_add($t0, $r->T);
1302
-        $r->T = self::fe_sub($t0, $r->T);
1293
+        $r->X = self::fe_add( $p->Y, $p->X );
1294
+        $r->Y = self::fe_sub( $p->Y, $p->X );
1295
+        $r->Z = self::fe_mul( $r->X, $q->yplusx );
1296
+        $r->Y = self::fe_mul( $r->Y, $q->yminusx );
1297
+        $r->T = self::fe_mul( $q->xy2d, $p->T );
1298
+        $t0 = self::fe_add( clone $p->Z, clone $p->Z );
1299
+        $r->X = self::fe_sub( $r->Z, $r->Y );
1300
+        $r->Y = self::fe_add( $r->Z, $r->Y );
1301
+        $r->Z = self::fe_add( $t0, $r->T );
1302
+        $r->T = self::fe_sub( $t0, $r->T );
1303 1303
 
1304 1304
         return $r;
1305 1305
     }
@@ -1319,16 +1319,16 @@  discard block
 block discarded – undo
1319 1319
     ) {
1320 1320
         $r = clone $R;
1321 1321
 
1322
-        $r->X = self::fe_add($p->Y, $p->X);
1323
-        $r->Y = self::fe_sub($p->Y, $p->X);
1324
-        $r->Z = self::fe_mul($r->X, $q->yminusx);
1325
-        $r->Y = self::fe_mul($r->Y, $q->yplusx);
1326
-        $r->T = self::fe_mul($q->xy2d, $p->T);
1327
-        $t0 = self::fe_add($p->Z, $p->Z);
1328
-        $r->X = self::fe_sub($r->Z, $r->Y);
1329
-        $r->Y = self::fe_add($r->Z, $r->Y);
1330
-        $r->Z = self::fe_sub($t0, $r->T);
1331
-        $r->T = self::fe_add($t0, $r->T);
1322
+        $r->X = self::fe_add( $p->Y, $p->X );
1323
+        $r->Y = self::fe_sub( $p->Y, $p->X );
1324
+        $r->Z = self::fe_mul( $r->X, $q->yminusx );
1325
+        $r->Y = self::fe_mul( $r->Y, $q->yplusx );
1326
+        $r->T = self::fe_mul( $q->xy2d, $p->T );
1327
+        $t0 = self::fe_add( $p->Z, $p->Z );
1328
+        $r->X = self::fe_sub( $r->Z, $r->Y );
1329
+        $r->Y = self::fe_add( $r->Z, $r->Y );
1330
+        $r->Z = self::fe_sub( $t0, $r->T );
1331
+        $r->T = self::fe_add( $t0, $r->T );
1332 1332
 
1333 1333
         return $r;
1334 1334
     }
@@ -1339,12 +1339,12 @@  discard block
 block discarded – undo
1339 1339
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p
1340 1340
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P2
1341 1341
      */
1342
-    public static function ge_p1p1_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)
1342
+    public static function ge_p1p1_to_p2( ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p )
1343 1343
     {
1344 1344
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P2();
1345
-        $r->X = self::fe_mul($p->X, $p->T);
1346
-        $r->Y = self::fe_mul($p->Y, $p->Z);
1347
-        $r->Z = self::fe_mul($p->Z, $p->T);
1345
+        $r->X = self::fe_mul( $p->X, $p->T );
1346
+        $r->Y = self::fe_mul( $p->Y, $p->Z );
1347
+        $r->Z = self::fe_mul( $p->Z, $p->T );
1348 1348
         return $r;
1349 1349
     }
1350 1350
 
@@ -1354,13 +1354,13 @@  discard block
 block discarded – undo
1354 1354
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p
1355 1355
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P3
1356 1356
      */
1357
-    public static function ge_p1p1_to_p3(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)
1357
+    public static function ge_p1p1_to_p3( ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p )
1358 1358
     {
1359 1359
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P3();
1360
-        $r->X = self::fe_mul($p->X, $p->T);
1361
-        $r->Y = self::fe_mul($p->Y, $p->Z);
1362
-        $r->Z = self::fe_mul($p->Z, $p->T);
1363
-        $r->T = self::fe_mul($p->X, $p->Y);
1360
+        $r->X = self::fe_mul( $p->X, $p->T );
1361
+        $r->Y = self::fe_mul( $p->Y, $p->Z );
1362
+        $r->Z = self::fe_mul( $p->Z, $p->T );
1363
+        $r->T = self::fe_mul( $p->X, $p->Y );
1364 1364
         return $r;
1365 1365
     }
1366 1366
 
@@ -1384,19 +1384,19 @@  discard block
 block discarded – undo
1384 1384
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p
1385 1385
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
1386 1386
      */
1387
-    public static function ge_p2_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p)
1387
+    public static function ge_p2_dbl( ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p )
1388 1388
     {
1389 1389
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P1p1();
1390 1390
 
1391
-        $r->X = self::fe_sq($p->X);
1392
-        $r->Z = self::fe_sq($p->Y);
1393
-        $r->T = self::fe_sq2($p->Z);
1394
-        $r->Y = self::fe_add($p->X, $p->Y);
1395
-        $t0   = self::fe_sq($r->Y);
1396
-        $r->Y = self::fe_add($r->Z, $r->X);
1397
-        $r->Z = self::fe_sub($r->Z, $r->X);
1398
-        $r->X = self::fe_sub($t0, $r->Y);
1399
-        $r->T = self::fe_sub($r->T, $r->Z);
1391
+        $r->X = self::fe_sq( $p->X );
1392
+        $r->Z = self::fe_sq( $p->Y );
1393
+        $r->T = self::fe_sq2( $p->Z );
1394
+        $r->Y = self::fe_add( $p->X, $p->Y );
1395
+        $t0   = self::fe_sq( $r->Y );
1396
+        $r->Y = self::fe_add( $r->Z, $r->X );
1397
+        $r->Z = self::fe_sub( $r->Z, $r->X );
1398
+        $r->X = self::fe_sub( $t0, $r->Y );
1399
+        $r->T = self::fe_sub( $r->T, $r->Z );
1400 1400
 
1401 1401
         return $r;
1402 1402
     }
@@ -1422,18 +1422,18 @@  discard block
 block discarded – undo
1422 1422
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
1423 1423
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_Cached
1424 1424
      */
1425
-    public static function ge_p3_to_cached(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)
1425
+    public static function ge_p3_to_cached( ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p )
1426 1426
     {
1427 1427
         static $d2 = null;
1428
-        if ($d2 === null) {
1429
-            $d2 = ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$d2);
1428
+        if ( $d2 === null ) {
1429
+            $d2 = ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$d2 );
1430 1430
         }
1431 1431
         /** @var ParagonIE_Sodium_Core_Curve25519_Fe $d2 */
1432 1432
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached();
1433
-        $r->YplusX = self::fe_add($p->Y, $p->X);
1434
-        $r->YminusX = self::fe_sub($p->Y, $p->X);
1435
-        $r->Z = self::fe_copy($p->Z);
1436
-        $r->T2d = self::fe_mul($p->T, $d2);
1433
+        $r->YplusX = self::fe_add( $p->Y, $p->X );
1434
+        $r->YminusX = self::fe_sub( $p->Y, $p->X );
1435
+        $r->Z = self::fe_copy( $p->Z );
1436
+        $r->T2d = self::fe_mul( $p->T, $d2 );
1437 1437
         return $r;
1438 1438
     }
1439 1439
 
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
1444 1444
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P2
1445 1445
      */
1446
-    public static function ge_p3_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)
1446
+    public static function ge_p3_to_p2( ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p )
1447 1447
     {
1448 1448
         return new ParagonIE_Sodium_Core_Curve25519_Ge_P2(
1449
-            self::fe_copy($p->X),
1450
-            self::fe_copy($p->Y),
1451
-            self::fe_copy($p->Z)
1449
+            self::fe_copy( $p->X ),
1450
+            self::fe_copy( $p->Y ),
1451
+            self::fe_copy( $p->Z )
1452 1452
         );
1453 1453
     }
1454 1454
 
@@ -1460,14 +1460,14 @@  discard block
 block discarded – undo
1460 1460
      * @throws SodiumException
1461 1461
      * @throws TypeError
1462 1462
      */
1463
-    public static function ge_p3_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h)
1463
+    public static function ge_p3_tobytes( ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h )
1464 1464
     {
1465
-        $recip = self::fe_invert($h->Z);
1466
-        $x = self::fe_mul($h->X, $recip);
1467
-        $y = self::fe_mul($h->Y, $recip);
1468
-        $s = self::fe_tobytes($y);
1469
-        $s[31] = self::intToChr(
1470
-            self::chrToInt($s[31]) ^ (self::fe_isnegative($x) << 7)
1465
+        $recip = self::fe_invert( $h->Z );
1466
+        $x = self::fe_mul( $h->X, $recip );
1467
+        $y = self::fe_mul( $h->Y, $recip );
1468
+        $s = self::fe_tobytes( $y );
1469
+        $s[ 31 ] = self::intToChr(
1470
+            self::chrToInt( $s[ 31 ] ) ^ ( self::fe_isnegative( $x ) << 7 )
1471 1471
         );
1472 1472
         return $s;
1473 1473
     }
@@ -1478,10 +1478,10 @@  discard block
 block discarded – undo
1478 1478
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
1479 1479
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
1480 1480
      */
1481
-    public static function ge_p3_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)
1481
+    public static function ge_p3_dbl( ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p )
1482 1482
     {
1483
-        $q = self::ge_p3_to_p2($p);
1484
-        return self::ge_p2_dbl($q);
1483
+        $q = self::ge_p3_to_p2( $p );
1484
+        return self::ge_p2_dbl( $q );
1485 1485
     }
1486 1486
 
1487 1487
     /**
@@ -1503,9 +1503,9 @@  discard block
 block discarded – undo
1503 1503
      * @param int $c
1504 1504
      * @return int
1505 1505
      */
1506
-    public static function equal($b, $c)
1506
+    public static function equal( $b, $c )
1507 1507
     {
1508
-        return (int) ((($b ^ $c) - 1) >> 31) & 1;
1508
+        return (int)( ( ( $b ^ $c ) - 1 ) >> 31 ) & 1;
1509 1509
     }
1510 1510
 
1511 1511
     /**
@@ -1516,13 +1516,13 @@  discard block
 block discarded – undo
1516 1516
      * @throws SodiumException
1517 1517
      * @throws TypeError
1518 1518
      */
1519
-    public static function negative($char)
1519
+    public static function negative( $char )
1520 1520
     {
1521
-        if (is_int($char)) {
1522
-            return ($char >> 63) & 1;
1521
+        if ( is_int( $char ) ) {
1522
+            return ( $char >> 63 ) & 1;
1523 1523
         }
1524
-        $x = self::chrToInt(self::substr($char, 0, 1));
1525
-        return (int) ($x >> 63);
1524
+        $x = self::chrToInt( self::substr( $char, 0, 1 ) );
1525
+        return (int)( $x >> 63 );
1526 1526
     }
1527 1527
 
1528 1528
     /**
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
         ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $u,
1541 1541
         $b
1542 1542
     ) {
1543
-        if (!is_int($b)) {
1544
-            throw new InvalidArgumentException('Expected an integer.');
1543
+        if ( ! is_int( $b ) ) {
1544
+            throw new InvalidArgumentException( 'Expected an integer.' );
1545 1545
         }
1546 1546
         return new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1547
-            self::fe_cmov($t->yplusx,  $u->yplusx,  $b),
1548
-            self::fe_cmov($t->yminusx, $u->yminusx, $b),
1549
-            self::fe_cmov($t->xy2d,    $u->xy2d,    $b)
1547
+            self::fe_cmov( $t->yplusx, $u->yplusx, $b ),
1548
+            self::fe_cmov( $t->yminusx, $u->yminusx, $b ),
1549
+            self::fe_cmov( $t->xy2d, $u->xy2d, $b )
1550 1550
         );
1551 1551
     }
1552 1552
 
@@ -1563,10 +1563,10 @@  discard block
 block discarded – undo
1563 1563
     ) {
1564 1564
         $b &= 1;
1565 1565
         $ret = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached();
1566
-        $ret->YplusX  = self::fe_cmov($t->YplusX,  $u->YplusX,  $b);
1567
-        $ret->YminusX = self::fe_cmov($t->YminusX, $u->YminusX, $b);
1568
-        $ret->Z       = self::fe_cmov($t->Z,       $u->Z,       $b);
1569
-        $ret->T2d     = self::fe_cmov($t->T2d,     $u->T2d,     $b);
1566
+        $ret->YplusX  = self::fe_cmov( $t->YplusX, $u->YplusX, $b );
1567
+        $ret->YminusX = self::fe_cmov( $t->YminusX, $u->YminusX, $b );
1568
+        $ret->Z       = self::fe_cmov( $t->Z, $u->Z, $b );
1569
+        $ret->T2d     = self::fe_cmov( $t->T2d, $u->T2d, $b );
1570 1570
         return $ret;
1571 1571
     }
1572 1572
 
@@ -1576,12 +1576,12 @@  discard block
 block discarded – undo
1576 1576
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_Cached
1577 1577
      * @throws SodiumException
1578 1578
      */
1579
-    public static function ge_cmov8_cached(array $cached, $b)
1579
+    public static function ge_cmov8_cached( array $cached, $b )
1580 1580
     {
1581 1581
         // const unsigned char bnegative = negative(b);
1582 1582
         // const unsigned char babs      = b - (((-bnegative) & b) * ((signed char) 1 << 1));
1583
-        $bnegative = self::negative($b);
1584
-        $babs = $b - (((-$bnegative) & $b) << 1);
1583
+        $bnegative = self::negative( $b );
1584
+        $babs = $b - ( ( (-$bnegative) & $b ) << 1 );
1585 1585
 
1586 1586
         // ge25519_cached_0(t);
1587 1587
         $t = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached(
@@ -1599,8 +1599,8 @@  discard block
 block discarded – undo
1599 1599
         // ge25519_cmov_cached(t, &cached[5], equal(babs, 6));
1600 1600
         // ge25519_cmov_cached(t, &cached[6], equal(babs, 7));
1601 1601
         // ge25519_cmov_cached(t, &cached[7], equal(babs, 8));
1602
-        for ($x = 0; $x < 8; ++$x) {
1603
-            $t = self::ge_cmov_cached($t, $cached[$x], self::equal($babs, $x + 1));
1602
+        for ( $x = 0; $x < 8; ++$x ) {
1603
+            $t = self::ge_cmov_cached( $t, $cached[ $x ], self::equal( $babs, $x + 1 ) );
1604 1604
         }
1605 1605
 
1606 1606
         // fe25519_copy(minust.YplusX, t->YminusX);
@@ -1608,12 +1608,12 @@  discard block
 block discarded – undo
1608 1608
         // fe25519_copy(minust.Z, t->Z);
1609 1609
         // fe25519_neg(minust.T2d, t->T2d);
1610 1610
         $minust = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached(
1611
-            self::fe_copy($t->YminusX),
1612
-            self::fe_copy($t->YplusX),
1613
-            self::fe_copy($t->Z),
1614
-            self::fe_neg($t->T2d)
1611
+            self::fe_copy( $t->YminusX ),
1612
+            self::fe_copy( $t->YplusX ),
1613
+            self::fe_copy( $t->Z ),
1614
+            self::fe_neg( $t->T2d )
1615 1615
         );
1616
-        return self::ge_cmov_cached($t, $minust, $bnegative);
1616
+        return self::ge_cmov_cached( $t, $minust, $bnegative );
1617 1617
     }
1618 1618
 
1619 1619
     /**
@@ -1628,47 +1628,47 @@  discard block
 block discarded – undo
1628 1628
      * @psalm-suppress MixedArrayAccess
1629 1629
      * @psalm-suppress MixedArrayOffset
1630 1630
      */
1631
-    public static function ge_select($pos = 0, $b = 0)
1631
+    public static function ge_select( $pos = 0, $b = 0 )
1632 1632
     {
1633 1633
         static $base = null;
1634
-        if ($base === null) {
1634
+        if ( $base === null ) {
1635 1635
             $base = array();
1636 1636
             /** @var int $i */
1637
-            foreach (self::$base as $i => $bas) {
1638
-                for ($j = 0; $j < 8; ++$j) {
1639
-                    $base[$i][$j] = new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1640
-                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($bas[$j][0]),
1641
-                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($bas[$j][1]),
1642
-                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($bas[$j][2])
1637
+            foreach ( self::$base as $i => $bas ) {
1638
+                for ( $j = 0; $j < 8; ++$j ) {
1639
+                    $base[ $i ][ $j ] = new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1640
+                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $bas[ $j ][ 0 ] ),
1641
+                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $bas[ $j ][ 1 ] ),
1642
+                        ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( $bas[ $j ][ 2 ] )
1643 1643
                     );
1644 1644
                 }
1645 1645
             }
1646 1646
         }
1647 1647
         /** @var array<int, array<int, ParagonIE_Sodium_Core_Curve25519_Ge_Precomp>> $base */
1648
-        if (!is_int($pos)) {
1649
-            throw new InvalidArgumentException('Position must be an integer');
1648
+        if ( ! is_int( $pos ) ) {
1649
+            throw new InvalidArgumentException( 'Position must be an integer' );
1650 1650
         }
1651
-        if ($pos < 0 || $pos > 31) {
1652
-            throw new RangeException('Position is out of range [0, 31]');
1651
+        if ( $pos < 0 || $pos > 31 ) {
1652
+            throw new RangeException( 'Position is out of range [0, 31]' );
1653 1653
         }
1654 1654
 
1655
-        $bnegative = self::negative($b);
1656
-        $babs = $b - (((-$bnegative) & $b) << 1);
1655
+        $bnegative = self::negative( $b );
1656
+        $babs = $b - ( ( (-$bnegative) & $b ) << 1 );
1657 1657
 
1658 1658
         $t = self::ge_precomp_0();
1659
-        for ($i = 0; $i < 8; ++$i) {
1659
+        for ( $i = 0; $i < 8; ++$i ) {
1660 1660
             $t = self::cmov(
1661 1661
                 $t,
1662
-                $base[$pos][$i],
1663
-                self::equal($babs, $i + 1)
1662
+                $base[ $pos ][ $i ],
1663
+                self::equal( $babs, $i + 1 )
1664 1664
             );
1665 1665
         }
1666 1666
         $minusT = new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1667
-            self::fe_copy($t->yminusx),
1668
-            self::fe_copy($t->yplusx),
1669
-            self::fe_neg($t->xy2d)
1667
+            self::fe_copy( $t->yminusx ),
1668
+            self::fe_copy( $t->yplusx ),
1669
+            self::fe_neg( $t->xy2d )
1670 1670
         );
1671
-        return self::cmov($t, $minusT, $bnegative);
1671
+        return self::cmov( $t, $minusT, $bnegative );
1672 1672
     }
1673 1673
 
1674 1674
     /**
@@ -1688,17 +1688,17 @@  discard block
 block discarded – undo
1688 1688
     ) {
1689 1689
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P1p1();
1690 1690
 
1691
-        $r->X = self::fe_add($p->Y, $p->X);
1692
-        $r->Y = self::fe_sub($p->Y, $p->X);
1693
-        $r->Z = self::fe_mul($r->X, $q->YminusX);
1694
-        $r->Y = self::fe_mul($r->Y, $q->YplusX);
1695
-        $r->T = self::fe_mul($q->T2d, $p->T);
1696
-        $r->X = self::fe_mul($p->Z, $q->Z);
1697
-        $t0 = self::fe_add($r->X, $r->X);
1698
-        $r->X = self::fe_sub($r->Z, $r->Y);
1699
-        $r->Y = self::fe_add($r->Z, $r->Y);
1700
-        $r->Z = self::fe_sub($t0, $r->T);
1701
-        $r->T = self::fe_add($t0, $r->T);
1691
+        $r->X = self::fe_add( $p->Y, $p->X );
1692
+        $r->Y = self::fe_sub( $p->Y, $p->X );
1693
+        $r->Z = self::fe_mul( $r->X, $q->YminusX );
1694
+        $r->Y = self::fe_mul( $r->Y, $q->YplusX );
1695
+        $r->T = self::fe_mul( $q->T2d, $p->T );
1696
+        $r->X = self::fe_mul( $p->Z, $q->Z );
1697
+        $t0 = self::fe_add( $r->X, $r->X );
1698
+        $r->X = self::fe_sub( $r->Z, $r->Y );
1699
+        $r->Y = self::fe_add( $r->Z, $r->Y );
1700
+        $r->Z = self::fe_sub( $t0, $r->T );
1701
+        $r->T = self::fe_add( $t0, $r->T );
1702 1702
 
1703 1703
         return $r;
1704 1704
     }
@@ -1711,14 +1711,14 @@  discard block
 block discarded – undo
1711 1711
      * @throws SodiumException
1712 1712
      * @throws TypeError
1713 1713
      */
1714
-    public static function ge_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h)
1714
+    public static function ge_tobytes( ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h )
1715 1715
     {
1716
-        $recip = self::fe_invert($h->Z);
1717
-        $x = self::fe_mul($h->X, $recip);
1718
-        $y = self::fe_mul($h->Y, $recip);
1719
-        $s = self::fe_tobytes($y);
1720
-        $s[31] = self::intToChr(
1721
-            self::chrToInt($s[31]) ^ (self::fe_isnegative($x) << 7)
1716
+        $recip = self::fe_invert( $h->Z );
1717
+        $x = self::fe_mul( $h->X, $recip );
1718
+        $y = self::fe_mul( $h->Y, $recip );
1719
+        $s = self::fe_tobytes( $y );
1720
+        $s[ 31 ] = self::intToChr(
1721
+            self::chrToInt( $s[ 31 ] ) ^ ( self::fe_isnegative( $x ) << 7 )
1722 1722
         );
1723 1723
         return $s;
1724 1724
     }
@@ -1745,17 +1745,17 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
         /** @var array<int, ParagonIE_Sodium_Core_Curve25519_Ge_Precomp> $Bi */
1747 1747
         static $Bi = array();
1748
-        if (!$Bi) {
1749
-            for ($i = 0; $i < 8; ++$i) {
1750
-                $Bi[$i] = new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1751
-                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$base2[$i][0]),
1752
-                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$base2[$i][1]),
1753
-                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(self::$base2[$i][2])
1748
+        if ( ! $Bi ) {
1749
+            for ( $i = 0; $i < 8; ++$i ) {
1750
+                $Bi[ $i ] = new ParagonIE_Sodium_Core_Curve25519_Ge_Precomp(
1751
+                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$base2[ $i ][ 0 ] ),
1752
+                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$base2[ $i ][ 1 ] ),
1753
+                    ParagonIE_Sodium_Core_Curve25519_Fe::fromArray( self::$base2[ $i ][ 2 ] )
1754 1754
                 );
1755 1755
             }
1756 1756
         }
1757
-        for ($i = 0; $i < 8; ++$i) {
1758
-            $Ai[$i] = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached(
1757
+        for ( $i = 0; $i < 8; ++$i ) {
1758
+            $Ai[ $i ] = new ParagonIE_Sodium_Core_Curve25519_Ge_Cached(
1759 1759
                 self::fe_0(),
1760 1760
                 self::fe_0(),
1761 1761
                 self::fe_0(),
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
         # slide(aslide,a);
1767 1767
         # slide(bslide,b);
1768 1768
         /** @var array<int, int> $aslide */
1769
-        $aslide = self::slide($a);
1769
+        $aslide = self::slide( $a );
1770 1770
         /** @var array<int, int> $bslide */
1771
-        $bslide = self::slide($b);
1771
+        $bslide = self::slide( $b );
1772 1772
 
1773 1773
         # ge_p3_to_cached(&Ai[0],A);
1774 1774
         # ge_p3_dbl(&t,A); ge_p1p1_to_p3(&A2,&t);
1775
-        $Ai[0] = self::ge_p3_to_cached($A);
1776
-        $t = self::ge_p3_dbl($A);
1777
-        $A2 = self::ge_p1p1_to_p3($t);
1775
+        $Ai[ 0 ] = self::ge_p3_to_cached( $A );
1776
+        $t = self::ge_p3_dbl( $A );
1777
+        $A2 = self::ge_p1p1_to_p3( $t );
1778 1778
 
1779 1779
         # ge_add(&t,&A2,&Ai[0]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[1],&u);
1780 1780
         # ge_add(&t,&A2,&Ai[1]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[2],&u);
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
         # ge_add(&t,&A2,&Ai[4]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[5],&u);
1784 1784
         # ge_add(&t,&A2,&Ai[5]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[6],&u);
1785 1785
         # ge_add(&t,&A2,&Ai[6]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[7],&u);
1786
-        for ($i = 0; $i < 7; ++$i) {
1787
-            $t = self::ge_add($A2, $Ai[$i]);
1788
-            $u = self::ge_p1p1_to_p3($t);
1789
-            $Ai[$i + 1] = self::ge_p3_to_cached($u);
1786
+        for ( $i = 0; $i < 7; ++$i ) {
1787
+            $t = self::ge_add( $A2, $Ai[ $i ] );
1788
+            $u = self::ge_p1p1_to_p3( $t );
1789
+            $Ai[ $i + 1 ] = self::ge_p3_to_cached( $u );
1790 1790
         }
1791 1791
 
1792 1792
         # ge_p2_0(r);
@@ -1796,56 +1796,56 @@  discard block
 block discarded – undo
1796 1796
         #     if (aslide[i] || bslide[i]) break;
1797 1797
         # }
1798 1798
         $i = 255;
1799
-        for (; $i >= 0; --$i) {
1800
-            if ($aslide[$i] || $bslide[$i]) {
1799
+        for ( ; $i >= 0; --$i ) {
1800
+            if ( $aslide[ $i ] || $bslide[ $i ] ) {
1801 1801
                 break;
1802 1802
             }
1803 1803
         }
1804 1804
 
1805 1805
         # for (;i >= 0;--i) {
1806
-        for (; $i >= 0; --$i) {
1806
+        for ( ; $i >= 0; --$i ) {
1807 1807
             # ge_p2_dbl(&t,r);
1808
-            $t = self::ge_p2_dbl($r);
1808
+            $t = self::ge_p2_dbl( $r );
1809 1809
 
1810 1810
             # if (aslide[i] > 0) {
1811
-            if ($aslide[$i] > 0) {
1811
+            if ( $aslide[ $i ] > 0 ) {
1812 1812
                 # ge_p1p1_to_p3(&u,&t);
1813 1813
                 # ge_add(&t,&u,&Ai[aslide[i]/2]);
1814
-                $u = self::ge_p1p1_to_p3($t);
1814
+                $u = self::ge_p1p1_to_p3( $t );
1815 1815
                 $t = self::ge_add(
1816 1816
                     $u,
1817
-                    $Ai[(int) floor($aslide[$i] / 2)]
1817
+                    $Ai[ (int)floor( $aslide[ $i ] / 2 ) ]
1818 1818
                 );
1819 1819
             # } else if (aslide[i] < 0) {
1820
-            } elseif ($aslide[$i] < 0) {
1820
+            } elseif ( $aslide[ $i ] < 0 ) {
1821 1821
                 # ge_p1p1_to_p3(&u,&t);
1822 1822
                 # ge_sub(&t,&u,&Ai[(-aslide[i])/2]);
1823
-                $u = self::ge_p1p1_to_p3($t);
1823
+                $u = self::ge_p1p1_to_p3( $t );
1824 1824
                 $t = self::ge_sub(
1825 1825
                     $u,
1826
-                    $Ai[(int) floor(-$aslide[$i] / 2)]
1826
+                    $Ai[ (int)floor(-$aslide[ $i ] / 2) ]
1827 1827
                 );
1828 1828
             }
1829 1829
 
1830 1830
             # if (bslide[i] > 0) {
1831
-            if ($bslide[$i] > 0) {
1831
+            if ( $bslide[ $i ] > 0 ) {
1832 1832
                 /** @var int $index */
1833
-                $index = (int) floor($bslide[$i] / 2);
1833
+                $index = (int)floor( $bslide[ $i ] / 2 );
1834 1834
                 # ge_p1p1_to_p3(&u,&t);
1835 1835
                 # ge_madd(&t,&u,&Bi[bslide[i]/2]);
1836
-                $u = self::ge_p1p1_to_p3($t);
1837
-                $t = self::ge_madd($t, $u, $Bi[$index]);
1836
+                $u = self::ge_p1p1_to_p3( $t );
1837
+                $t = self::ge_madd( $t, $u, $Bi[ $index ] );
1838 1838
             # } else if (bslide[i] < 0) {
1839
-            } elseif ($bslide[$i] < 0) {
1839
+            } elseif ( $bslide[ $i ] < 0 ) {
1840 1840
                 /** @var int $index */
1841
-                $index = (int) floor(-$bslide[$i] / 2);
1841
+                $index = (int)floor(-$bslide[ $i ] / 2);
1842 1842
                 # ge_p1p1_to_p3(&u,&t);
1843 1843
                 # ge_msub(&t,&u,&Bi[(-bslide[i])/2]);
1844
-                $u = self::ge_p1p1_to_p3($t);
1845
-                $t = self::ge_msub($t, $u, $Bi[$index]);
1844
+                $u = self::ge_p1p1_to_p3( $t );
1845
+                $t = self::ge_msub( $t, $u, $Bi[ $index ] );
1846 1846
             }
1847 1847
             # ge_p1p1_to_p2(r,&t);
1848
-            $r = self::ge_p1p1_to_p2($t);
1848
+            $r = self::ge_p1p1_to_p2( $t );
1849 1849
         }
1850 1850
         return $r;
1851 1851
     }
@@ -1861,73 +1861,73 @@  discard block
 block discarded – undo
1861 1861
      * @psalm-suppress MixedAssignment
1862 1862
      * @psalm-suppress MixedOperand
1863 1863
      */
1864
-    public static function ge_scalarmult($a, $p)
1864
+    public static function ge_scalarmult( $a, $p )
1865 1865
     {
1866
-        $e = array_fill(0, 64, 0);
1866
+        $e = array_fill( 0, 64, 0 );
1867 1867
 
1868 1868
         /** @var ParagonIE_Sodium_Core_Curve25519_Ge_Cached[] $pi */
1869 1869
         $pi = array();
1870 1870
 
1871 1871
         //        ge25519_p3_to_cached(&pi[1 - 1], p);   /* p */
1872
-        $pi[0] = self::ge_p3_to_cached($p);
1872
+        $pi[ 0 ] = self::ge_p3_to_cached( $p );
1873 1873
 
1874 1874
         //        ge25519_p3_dbl(&t2, p);
1875 1875
         //        ge25519_p1p1_to_p3(&p2, &t2);
1876 1876
         //        ge25519_p3_to_cached(&pi[2 - 1], &p2); /* 2p = 2*p */
1877
-        $t2 = self::ge_p3_dbl($p);
1878
-        $p2 = self::ge_p1p1_to_p3($t2);
1879
-        $pi[1] = self::ge_p3_to_cached($p2);
1877
+        $t2 = self::ge_p3_dbl( $p );
1878
+        $p2 = self::ge_p1p1_to_p3( $t2 );
1879
+        $pi[ 1 ] = self::ge_p3_to_cached( $p2 );
1880 1880
 
1881 1881
         //        ge25519_add_cached(&t3, p, &pi[2 - 1]);
1882 1882
         //        ge25519_p1p1_to_p3(&p3, &t3);
1883 1883
         //        ge25519_p3_to_cached(&pi[3 - 1], &p3); /* 3p = 2p+p */
1884
-        $t3 = self::ge_add($p, $pi[1]);
1885
-        $p3 = self::ge_p1p1_to_p3($t3);
1886
-        $pi[2] = self::ge_p3_to_cached($p3);
1884
+        $t3 = self::ge_add( $p, $pi[ 1 ] );
1885
+        $p3 = self::ge_p1p1_to_p3( $t3 );
1886
+        $pi[ 2 ] = self::ge_p3_to_cached( $p3 );
1887 1887
 
1888 1888
         //        ge25519_p3_dbl(&t4, &p2);
1889 1889
         //        ge25519_p1p1_to_p3(&p4, &t4);
1890 1890
         //        ge25519_p3_to_cached(&pi[4 - 1], &p4); /* 4p = 2*2p */
1891
-        $t4 = self::ge_p3_dbl($p2);
1892
-        $p4 = self::ge_p1p1_to_p3($t4);
1893
-        $pi[3] = self::ge_p3_to_cached($p4);
1891
+        $t4 = self::ge_p3_dbl( $p2 );
1892
+        $p4 = self::ge_p1p1_to_p3( $t4 );
1893
+        $pi[ 3 ] = self::ge_p3_to_cached( $p4 );
1894 1894
 
1895 1895
         //        ge25519_add_cached(&t5, p, &pi[4 - 1]);
1896 1896
         //        ge25519_p1p1_to_p3(&p5, &t5);
1897 1897
         //        ge25519_p3_to_cached(&pi[5 - 1], &p5); /* 5p = 4p+p */
1898
-        $t5 = self::ge_add($p, $pi[3]);
1899
-        $p5 = self::ge_p1p1_to_p3($t5);
1900
-        $pi[4] = self::ge_p3_to_cached($p5);
1898
+        $t5 = self::ge_add( $p, $pi[ 3 ] );
1899
+        $p5 = self::ge_p1p1_to_p3( $t5 );
1900
+        $pi[ 4 ] = self::ge_p3_to_cached( $p5 );
1901 1901
 
1902 1902
         //        ge25519_p3_dbl(&t6, &p3);
1903 1903
         //        ge25519_p1p1_to_p3(&p6, &t6);
1904 1904
         //        ge25519_p3_to_cached(&pi[6 - 1], &p6); /* 6p = 2*3p */
1905
-        $t6 = self::ge_p3_dbl($p3);
1906
-        $p6 = self::ge_p1p1_to_p3($t6);
1907
-        $pi[5] = self::ge_p3_to_cached($p6);
1905
+        $t6 = self::ge_p3_dbl( $p3 );
1906
+        $p6 = self::ge_p1p1_to_p3( $t6 );
1907
+        $pi[ 5 ] = self::ge_p3_to_cached( $p6 );
1908 1908
 
1909 1909
         //        ge25519_add_cached(&t7, p, &pi[6 - 1]);
1910 1910
         //        ge25519_p1p1_to_p3(&p7, &t7);
1911 1911
         //        ge25519_p3_to_cached(&pi[7 - 1], &p7); /* 7p = 6p+p */
1912
-        $t7 = self::ge_add($p, $pi[5]);
1913
-        $p7 = self::ge_p1p1_to_p3($t7);
1914
-        $pi[6] = self::ge_p3_to_cached($p7);
1912
+        $t7 = self::ge_add( $p, $pi[ 5 ] );
1913
+        $p7 = self::ge_p1p1_to_p3( $t7 );
1914
+        $pi[ 6 ] = self::ge_p3_to_cached( $p7 );
1915 1915
 
1916 1916
         //        ge25519_p3_dbl(&t8, &p4);
1917 1917
         //        ge25519_p1p1_to_p3(&p8, &t8);
1918 1918
         //        ge25519_p3_to_cached(&pi[8 - 1], &p8); /* 8p = 2*4p */
1919
-        $t8 = self::ge_p3_dbl($p4);
1920
-        $p8 = self::ge_p1p1_to_p3($t8);
1921
-        $pi[7] = self::ge_p3_to_cached($p8);
1919
+        $t8 = self::ge_p3_dbl( $p4 );
1920
+        $p8 = self::ge_p1p1_to_p3( $t8 );
1921
+        $pi[ 7 ] = self::ge_p3_to_cached( $p8 );
1922 1922
 
1923 1923
 
1924 1924
         //        for (i = 0; i < 32; ++i) {
1925 1925
         //            e[2 * i + 0] = (a[i] >> 0) & 15;
1926 1926
         //            e[2 * i + 1] = (a[i] >> 4) & 15;
1927 1927
         //        }
1928
-        for ($i = 0; $i < 32; ++$i) {
1929
-            $e[($i << 1)    ] =  self::chrToInt($a[$i]) & 15;
1930
-            $e[($i << 1) + 1] = (self::chrToInt($a[$i]) >> 4) & 15;
1928
+        for ( $i = 0; $i < 32; ++$i ) {
1929
+            $e[ ( $i << 1 ) ] = self::chrToInt( $a[ $i ] ) & 15;
1930
+            $e[ ( $i << 1 ) + 1 ] = ( self::chrToInt( $a[ $i ] ) >> 4 ) & 15;
1931 1931
         }
1932 1932
         //        /* each e[i] is between 0 and 15 */
1933 1933
         //        /* e[63] is between 0 and 7 */
@@ -1940,25 +1940,25 @@  discard block
 block discarded – undo
1940 1940
         //            e[i] -= carry * ((signed char) 1 << 4);
1941 1941
         //        }
1942 1942
         $carry = 0;
1943
-        for ($i = 0; $i < 63; ++$i) {
1944
-            $e[$i] += $carry;
1945
-            $carry = $e[$i] + 8;
1943
+        for ( $i = 0; $i < 63; ++$i ) {
1944
+            $e[ $i ] += $carry;
1945
+            $carry = $e[ $i ] + 8;
1946 1946
             $carry >>= 4;
1947
-            $e[$i] -= $carry << 4;
1947
+            $e[ $i ] -= $carry << 4;
1948 1948
         }
1949 1949
         //        e[63] += carry;
1950 1950
         //        /* each e[i] is between -8 and 8 */
1951
-        $e[63] += $carry;
1951
+        $e[ 63 ] += $carry;
1952 1952
 
1953 1953
         //        ge25519_p3_0(h);
1954 1954
         $h = self::ge_p3_0();
1955 1955
 
1956 1956
         //        for (i = 63; i != 0; i--) {
1957
-        for ($i = 63; $i != 0; --$i) {
1957
+        for ( $i = 63; $i != 0; --$i ) {
1958 1958
             // ge25519_cmov8_cached(&t, pi, e[i]);
1959
-            $t = self::ge_cmov8_cached($pi, $e[$i]);
1959
+            $t = self::ge_cmov8_cached( $pi, $e[ $i ] );
1960 1960
             // ge25519_add_cached(&r, h, &t);
1961
-            $r = self::ge_add($h, $t);
1961
+            $r = self::ge_add( $h, $t );
1962 1962
 
1963 1963
             // ge25519_p1p1_to_p2(&s, &r);
1964 1964
             // ge25519_p2_dbl(&r, &s);
@@ -1968,25 +1968,25 @@  discard block
 block discarded – undo
1968 1968
             // ge25519_p2_dbl(&r, &s);
1969 1969
             // ge25519_p1p1_to_p2(&s, &r);
1970 1970
             // ge25519_p2_dbl(&r, &s);
1971
-            $s = self::ge_p1p1_to_p2($r);
1972
-            $r = self::ge_p2_dbl($s);
1973
-            $s = self::ge_p1p1_to_p2($r);
1974
-            $r = self::ge_p2_dbl($s);
1975
-            $s = self::ge_p1p1_to_p2($r);
1976
-            $r = self::ge_p2_dbl($s);
1977
-            $s = self::ge_p1p1_to_p2($r);
1978
-            $r = self::ge_p2_dbl($s);
1971
+            $s = self::ge_p1p1_to_p2( $r );
1972
+            $r = self::ge_p2_dbl( $s );
1973
+            $s = self::ge_p1p1_to_p2( $r );
1974
+            $r = self::ge_p2_dbl( $s );
1975
+            $s = self::ge_p1p1_to_p2( $r );
1976
+            $r = self::ge_p2_dbl( $s );
1977
+            $s = self::ge_p1p1_to_p2( $r );
1978
+            $r = self::ge_p2_dbl( $s );
1979 1979
 
1980 1980
             // ge25519_p1p1_to_p3(h, &r);  /* *16 */
1981
-            $h = self::ge_p1p1_to_p3($r); /* *16 */
1981
+            $h = self::ge_p1p1_to_p3( $r ); /* *16 */
1982 1982
         }
1983 1983
 
1984 1984
         //        ge25519_cmov8_cached(&t, pi, e[i]);
1985 1985
         //        ge25519_add_cached(&r, h, &t);
1986 1986
         //        ge25519_p1p1_to_p3(h, &r);
1987
-        $t = self::ge_cmov8_cached($pi, $e[0]);
1988
-        $r = self::ge_add($h, $t);
1989
-        return self::ge_p1p1_to_p3($r);
1987
+        $t = self::ge_cmov8_cached( $pi, $e[ 0 ] );
1988
+        $r = self::ge_add( $h, $t );
1989
+        return self::ge_p1p1_to_p3( $r );
1990 1990
     }
1991 1991
 
1992 1992
     /**
@@ -1999,50 +1999,50 @@  discard block
 block discarded – undo
1999 1999
      * @psalm-suppress MixedAssignment
2000 2000
      * @psalm-suppress MixedOperand
2001 2001
      */
2002
-    public static function ge_scalarmult_base($a)
2002
+    public static function ge_scalarmult_base( $a )
2003 2003
     {
2004 2004
         /** @var array<int, int> $e */
2005 2005
         $e = array();
2006 2006
         $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P1p1();
2007 2007
 
2008
-        for ($i = 0; $i < 32; ++$i) {
2009
-            $dbl = (int) $i << 1;
2010
-            $e[$dbl] = (int) self::chrToInt($a[$i]) & 15;
2011
-            $e[$dbl + 1] = (int) (self::chrToInt($a[$i]) >> 4) & 15;
2008
+        for ( $i = 0; $i < 32; ++$i ) {
2009
+            $dbl = (int)$i << 1;
2010
+            $e[ $dbl ] = (int)self::chrToInt( $a[ $i ] ) & 15;
2011
+            $e[ $dbl + 1 ] = (int)( self::chrToInt( $a[ $i ] ) >> 4 ) & 15;
2012 2012
         }
2013 2013
 
2014 2014
         $carry = 0;
2015
-        for ($i = 0; $i < 63; ++$i) {
2016
-            $e[$i] += $carry;
2017
-            $carry = $e[$i] + 8;
2015
+        for ( $i = 0; $i < 63; ++$i ) {
2016
+            $e[ $i ] += $carry;
2017
+            $carry = $e[ $i ] + 8;
2018 2018
             $carry >>= 4;
2019
-            $e[$i] -= $carry << 4;
2019
+            $e[ $i ] -= $carry << 4;
2020 2020
         }
2021
-        $e[63] += (int) $carry;
2021
+        $e[ 63 ] += (int)$carry;
2022 2022
 
2023 2023
         $h = self::ge_p3_0();
2024 2024
 
2025
-        for ($i = 1; $i < 64; $i += 2) {
2026
-            $t = self::ge_select((int) floor($i / 2), (int) $e[$i]);
2027
-            $r = self::ge_madd($r, $h, $t);
2028
-            $h = self::ge_p1p1_to_p3($r);
2025
+        for ( $i = 1; $i < 64; $i += 2 ) {
2026
+            $t = self::ge_select( (int)floor( $i / 2 ), (int)$e[ $i ] );
2027
+            $r = self::ge_madd( $r, $h, $t );
2028
+            $h = self::ge_p1p1_to_p3( $r );
2029 2029
         }
2030 2030
 
2031
-        $r = self::ge_p3_dbl($h);
2031
+        $r = self::ge_p3_dbl( $h );
2032 2032
 
2033
-        $s = self::ge_p1p1_to_p2($r);
2034
-        $r = self::ge_p2_dbl($s);
2035
-        $s = self::ge_p1p1_to_p2($r);
2036
-        $r = self::ge_p2_dbl($s);
2037
-        $s = self::ge_p1p1_to_p2($r);
2038
-        $r = self::ge_p2_dbl($s);
2033
+        $s = self::ge_p1p1_to_p2( $r );
2034
+        $r = self::ge_p2_dbl( $s );
2035
+        $s = self::ge_p1p1_to_p2( $r );
2036
+        $r = self::ge_p2_dbl( $s );
2037
+        $s = self::ge_p1p1_to_p2( $r );
2038
+        $r = self::ge_p2_dbl( $s );
2039 2039
 
2040
-        $h = self::ge_p1p1_to_p3($r);
2040
+        $h = self::ge_p1p1_to_p3( $r );
2041 2041
 
2042
-        for ($i = 0; $i < 64; $i += 2) {
2043
-            $t = self::ge_select($i >> 1, (int) $e[$i]);
2044
-            $r = self::ge_madd($r, $h, $t);
2045
-            $h = self::ge_p1p1_to_p3($r);
2042
+        for ( $i = 0; $i < 64; $i += 2 ) {
2043
+            $t = self::ge_select( $i >> 1, (int)$e[ $i ] );
2044
+            $r = self::ge_madd( $r, $h, $t );
2045
+            $h = self::ge_p1p1_to_p3( $r );
2046 2046
         }
2047 2047
         return $h;
2048 2048
     }
@@ -2059,330 +2059,330 @@  discard block
 block discarded – undo
2059 2059
      * @return string
2060 2060
      * @throws TypeError
2061 2061
      */
2062
-    public static function sc_muladd($a, $b, $c)
2062
+    public static function sc_muladd( $a, $b, $c )
2063 2063
     {
2064
-        $a0 = 2097151 & self::load_3(self::substr($a, 0, 3));
2065
-        $a1 = 2097151 & (self::load_4(self::substr($a, 2, 4)) >> 5);
2066
-        $a2 = 2097151 & (self::load_3(self::substr($a, 5, 3)) >> 2);
2067
-        $a3 = 2097151 & (self::load_4(self::substr($a, 7, 4)) >> 7);
2068
-        $a4 = 2097151 & (self::load_4(self::substr($a, 10, 4)) >> 4);
2069
-        $a5 = 2097151 & (self::load_3(self::substr($a, 13, 3)) >> 1);
2070
-        $a6 = 2097151 & (self::load_4(self::substr($a, 15, 4)) >> 6);
2071
-        $a7 = 2097151 & (self::load_3(self::substr($a, 18, 3)) >> 3);
2072
-        $a8 = 2097151 & self::load_3(self::substr($a, 21, 3));
2073
-        $a9 = 2097151 & (self::load_4(self::substr($a, 23, 4)) >> 5);
2074
-        $a10 = 2097151 & (self::load_3(self::substr($a, 26, 3)) >> 2);
2075
-        $a11 = (self::load_4(self::substr($a, 28, 4)) >> 7);
2076
-
2077
-        $b0 = 2097151 & self::load_3(self::substr($b, 0, 3));
2078
-        $b1 = 2097151 & (self::load_4(self::substr($b, 2, 4)) >> 5);
2079
-        $b2 = 2097151 & (self::load_3(self::substr($b, 5, 3)) >> 2);
2080
-        $b3 = 2097151 & (self::load_4(self::substr($b, 7, 4)) >> 7);
2081
-        $b4 = 2097151 & (self::load_4(self::substr($b, 10, 4)) >> 4);
2082
-        $b5 = 2097151 & (self::load_3(self::substr($b, 13, 3)) >> 1);
2083
-        $b6 = 2097151 & (self::load_4(self::substr($b, 15, 4)) >> 6);
2084
-        $b7 = 2097151 & (self::load_3(self::substr($b, 18, 3)) >> 3);
2085
-        $b8 = 2097151 & self::load_3(self::substr($b, 21, 3));
2086
-        $b9 = 2097151 & (self::load_4(self::substr($b, 23, 4)) >> 5);
2087
-        $b10 = 2097151 & (self::load_3(self::substr($b, 26, 3)) >> 2);
2088
-        $b11 = (self::load_4(self::substr($b, 28, 4)) >> 7);
2089
-
2090
-        $c0 = 2097151 & self::load_3(self::substr($c, 0, 3));
2091
-        $c1 = 2097151 & (self::load_4(self::substr($c, 2, 4)) >> 5);
2092
-        $c2 = 2097151 & (self::load_3(self::substr($c, 5, 3)) >> 2);
2093
-        $c3 = 2097151 & (self::load_4(self::substr($c, 7, 4)) >> 7);
2094
-        $c4 = 2097151 & (self::load_4(self::substr($c, 10, 4)) >> 4);
2095
-        $c5 = 2097151 & (self::load_3(self::substr($c, 13, 3)) >> 1);
2096
-        $c6 = 2097151 & (self::load_4(self::substr($c, 15, 4)) >> 6);
2097
-        $c7 = 2097151 & (self::load_3(self::substr($c, 18, 3)) >> 3);
2098
-        $c8 = 2097151 & self::load_3(self::substr($c, 21, 3));
2099
-        $c9 = 2097151 & (self::load_4(self::substr($c, 23, 4)) >> 5);
2100
-        $c10 = 2097151 & (self::load_3(self::substr($c, 26, 3)) >> 2);
2101
-        $c11 = (self::load_4(self::substr($c, 28, 4)) >> 7);
2064
+        $a0 = 2097151 & self::load_3( self::substr( $a, 0, 3 ) );
2065
+        $a1 = 2097151 & ( self::load_4( self::substr( $a, 2, 4 ) ) >> 5 );
2066
+        $a2 = 2097151 & ( self::load_3( self::substr( $a, 5, 3 ) ) >> 2 );
2067
+        $a3 = 2097151 & ( self::load_4( self::substr( $a, 7, 4 ) ) >> 7 );
2068
+        $a4 = 2097151 & ( self::load_4( self::substr( $a, 10, 4 ) ) >> 4 );
2069
+        $a5 = 2097151 & ( self::load_3( self::substr( $a, 13, 3 ) ) >> 1 );
2070
+        $a6 = 2097151 & ( self::load_4( self::substr( $a, 15, 4 ) ) >> 6 );
2071
+        $a7 = 2097151 & ( self::load_3( self::substr( $a, 18, 3 ) ) >> 3 );
2072
+        $a8 = 2097151 & self::load_3( self::substr( $a, 21, 3 ) );
2073
+        $a9 = 2097151 & ( self::load_4( self::substr( $a, 23, 4 ) ) >> 5 );
2074
+        $a10 = 2097151 & ( self::load_3( self::substr( $a, 26, 3 ) ) >> 2 );
2075
+        $a11 = ( self::load_4( self::substr( $a, 28, 4 ) ) >> 7 );
2076
+
2077
+        $b0 = 2097151 & self::load_3( self::substr( $b, 0, 3 ) );
2078
+        $b1 = 2097151 & ( self::load_4( self::substr( $b, 2, 4 ) ) >> 5 );
2079
+        $b2 = 2097151 & ( self::load_3( self::substr( $b, 5, 3 ) ) >> 2 );
2080
+        $b3 = 2097151 & ( self::load_4( self::substr( $b, 7, 4 ) ) >> 7 );
2081
+        $b4 = 2097151 & ( self::load_4( self::substr( $b, 10, 4 ) ) >> 4 );
2082
+        $b5 = 2097151 & ( self::load_3( self::substr( $b, 13, 3 ) ) >> 1 );
2083
+        $b6 = 2097151 & ( self::load_4( self::substr( $b, 15, 4 ) ) >> 6 );
2084
+        $b7 = 2097151 & ( self::load_3( self::substr( $b, 18, 3 ) ) >> 3 );
2085
+        $b8 = 2097151 & self::load_3( self::substr( $b, 21, 3 ) );
2086
+        $b9 = 2097151 & ( self::load_4( self::substr( $b, 23, 4 ) ) >> 5 );
2087
+        $b10 = 2097151 & ( self::load_3( self::substr( $b, 26, 3 ) ) >> 2 );
2088
+        $b11 = ( self::load_4( self::substr( $b, 28, 4 ) ) >> 7 );
2089
+
2090
+        $c0 = 2097151 & self::load_3( self::substr( $c, 0, 3 ) );
2091
+        $c1 = 2097151 & ( self::load_4( self::substr( $c, 2, 4 ) ) >> 5 );
2092
+        $c2 = 2097151 & ( self::load_3( self::substr( $c, 5, 3 ) ) >> 2 );
2093
+        $c3 = 2097151 & ( self::load_4( self::substr( $c, 7, 4 ) ) >> 7 );
2094
+        $c4 = 2097151 & ( self::load_4( self::substr( $c, 10, 4 ) ) >> 4 );
2095
+        $c5 = 2097151 & ( self::load_3( self::substr( $c, 13, 3 ) ) >> 1 );
2096
+        $c6 = 2097151 & ( self::load_4( self::substr( $c, 15, 4 ) ) >> 6 );
2097
+        $c7 = 2097151 & ( self::load_3( self::substr( $c, 18, 3 ) ) >> 3 );
2098
+        $c8 = 2097151 & self::load_3( self::substr( $c, 21, 3 ) );
2099
+        $c9 = 2097151 & ( self::load_4( self::substr( $c, 23, 4 ) ) >> 5 );
2100
+        $c10 = 2097151 & ( self::load_3( self::substr( $c, 26, 3 ) ) >> 2 );
2101
+        $c11 = ( self::load_4( self::substr( $c, 28, 4 ) ) >> 7 );
2102 2102
 
2103 2103
         /* Can't really avoid the pyramid here: */
2104
-        $s0 = $c0 + self::mul($a0, $b0, 24);
2105
-        $s1 = $c1 + self::mul($a0, $b1, 24) + self::mul($a1, $b0, 24);
2106
-        $s2 = $c2 + self::mul($a0, $b2, 24) + self::mul($a1, $b1, 24) + self::mul($a2, $b0, 24);
2107
-        $s3 = $c3 + self::mul($a0, $b3, 24) + self::mul($a1, $b2, 24) + self::mul($a2, $b1, 24) + self::mul($a3, $b0, 24);
2108
-        $s4 = $c4 + self::mul($a0, $b4, 24) + self::mul($a1, $b3, 24) + self::mul($a2, $b2, 24) + self::mul($a3, $b1, 24) +
2109
-               self::mul($a4, $b0, 24);
2110
-        $s5 = $c5 + self::mul($a0, $b5, 24) + self::mul($a1, $b4, 24) + self::mul($a2, $b3, 24) + self::mul($a3, $b2, 24) +
2111
-               self::mul($a4, $b1, 24) + self::mul($a5, $b0, 24);
2112
-        $s6 = $c6 + self::mul($a0, $b6, 24) + self::mul($a1, $b5, 24) + self::mul($a2, $b4, 24) + self::mul($a3, $b3, 24) +
2113
-               self::mul($a4, $b2, 24) + self::mul($a5, $b1, 24) + self::mul($a6, $b0, 24);
2114
-        $s7 = $c7 + self::mul($a0, $b7, 24) + self::mul($a1, $b6, 24) + self::mul($a2, $b5, 24) + self::mul($a3, $b4, 24) +
2115
-               self::mul($a4, $b3, 24) + self::mul($a5, $b2, 24) + self::mul($a6, $b1, 24) + self::mul($a7, $b0, 24);
2116
-        $s8 = $c8 + self::mul($a0, $b8, 24) + self::mul($a1, $b7, 24) + self::mul($a2, $b6, 24) + self::mul($a3, $b5, 24) +
2117
-               self::mul($a4, $b4, 24) + self::mul($a5, $b3, 24) + self::mul($a6, $b2, 24) + self::mul($a7, $b1, 24) +
2118
-               self::mul($a8, $b0, 24);
2119
-        $s9 = $c9 + self::mul($a0, $b9, 24) + self::mul($a1, $b8, 24) + self::mul($a2, $b7, 24) + self::mul($a3, $b6, 24) +
2120
-               self::mul($a4, $b5, 24) + self::mul($a5, $b4, 24) + self::mul($a6, $b3, 24) + self::mul($a7, $b2, 24) +
2121
-               self::mul($a8, $b1, 24) + self::mul($a9, $b0, 24);
2122
-        $s10 = $c10 + self::mul($a0, $b10, 24) + self::mul($a1, $b9, 24) + self::mul($a2, $b8, 24) + self::mul($a3, $b7, 24) +
2123
-               self::mul($a4, $b6, 24) + self::mul($a5, $b5, 24) + self::mul($a6, $b4, 24) + self::mul($a7, $b3, 24) +
2124
-               self::mul($a8, $b2, 24) + self::mul($a9, $b1, 24) + self::mul($a10, $b0, 24);
2125
-        $s11 = $c11 + self::mul($a0, $b11, 24) + self::mul($a1, $b10, 24) + self::mul($a2, $b9, 24) + self::mul($a3, $b8, 24) +
2126
-               self::mul($a4, $b7, 24) + self::mul($a5, $b6, 24) + self::mul($a6, $b5, 24) + self::mul($a7, $b4, 24) +
2127
-               self::mul($a8, $b3, 24) + self::mul($a9, $b2, 24) + self::mul($a10, $b1, 24) + self::mul($a11, $b0, 24);
2128
-        $s12 = self::mul($a1, $b11, 24) + self::mul($a2, $b10, 24) + self::mul($a3, $b9, 24) + self::mul($a4, $b8, 24) +
2129
-               self::mul($a5, $b7, 24) + self::mul($a6, $b6, 24) + self::mul($a7, $b5, 24) + self::mul($a8, $b4, 24) +
2130
-               self::mul($a9, $b3, 24) + self::mul($a10, $b2, 24) + self::mul($a11, $b1, 24);
2131
-        $s13 = self::mul($a2, $b11, 24) + self::mul($a3, $b10, 24) + self::mul($a4, $b9, 24) + self::mul($a5, $b8, 24) +
2132
-               self::mul($a6, $b7, 24) + self::mul($a7, $b6, 24) + self::mul($a8, $b5, 24) + self::mul($a9, $b4, 24) +
2133
-               self::mul($a10, $b3, 24) + self::mul($a11, $b2, 24);
2134
-        $s14 = self::mul($a3, $b11, 24) + self::mul($a4, $b10, 24) + self::mul($a5, $b9, 24) + self::mul($a6, $b8, 24) +
2135
-               self::mul($a7, $b7, 24) + self::mul($a8, $b6, 24) + self::mul($a9, $b5, 24) + self::mul($a10, $b4, 24) +
2136
-               self::mul($a11, $b3, 24);
2137
-        $s15 = self::mul($a4, $b11, 24) + self::mul($a5, $b10, 24) + self::mul($a6, $b9, 24) + self::mul($a7, $b8, 24) +
2138
-               self::mul($a8, $b7, 24) + self::mul($a9, $b6, 24) + self::mul($a10, $b5, 24) + self::mul($a11, $b4, 24);
2139
-        $s16 = self::mul($a5, $b11, 24) + self::mul($a6, $b10, 24) + self::mul($a7, $b9, 24) + self::mul($a8, $b8, 24) +
2140
-               self::mul($a9, $b7, 24) + self::mul($a10, $b6, 24) + self::mul($a11, $b5, 24);
2141
-        $s17 = self::mul($a6, $b11, 24) + self::mul($a7, $b10, 24) + self::mul($a8, $b9, 24) + self::mul($a9, $b8, 24) +
2142
-               self::mul($a10, $b7, 24) + self::mul($a11, $b6, 24);
2143
-        $s18 = self::mul($a7, $b11, 24) + self::mul($a8, $b10, 24) + self::mul($a9, $b9, 24) + self::mul($a10, $b8, 24) +
2144
-               self::mul($a11, $b7, 24);
2145
-        $s19 = self::mul($a8, $b11, 24) + self::mul($a9, $b10, 24) + self::mul($a10, $b9, 24) + self::mul($a11, $b8, 24);
2146
-        $s20 = self::mul($a9, $b11, 24) + self::mul($a10, $b10, 24) + self::mul($a11, $b9, 24);
2147
-        $s21 = self::mul($a10, $b11, 24) + self::mul($a11, $b10, 24);
2148
-        $s22 = self::mul($a11, $b11, 24);
2104
+        $s0 = $c0 + self::mul( $a0, $b0, 24 );
2105
+        $s1 = $c1 + self::mul( $a0, $b1, 24 ) + self::mul( $a1, $b0, 24 );
2106
+        $s2 = $c2 + self::mul( $a0, $b2, 24 ) + self::mul( $a1, $b1, 24 ) + self::mul( $a2, $b0, 24 );
2107
+        $s3 = $c3 + self::mul( $a0, $b3, 24 ) + self::mul( $a1, $b2, 24 ) + self::mul( $a2, $b1, 24 ) + self::mul( $a3, $b0, 24 );
2108
+        $s4 = $c4 + self::mul( $a0, $b4, 24 ) + self::mul( $a1, $b3, 24 ) + self::mul( $a2, $b2, 24 ) + self::mul( $a3, $b1, 24 ) +
2109
+               self::mul( $a4, $b0, 24 );
2110
+        $s5 = $c5 + self::mul( $a0, $b5, 24 ) + self::mul( $a1, $b4, 24 ) + self::mul( $a2, $b3, 24 ) + self::mul( $a3, $b2, 24 ) +
2111
+               self::mul( $a4, $b1, 24 ) + self::mul( $a5, $b0, 24 );
2112
+        $s6 = $c6 + self::mul( $a0, $b6, 24 ) + self::mul( $a1, $b5, 24 ) + self::mul( $a2, $b4, 24 ) + self::mul( $a3, $b3, 24 ) +
2113
+               self::mul( $a4, $b2, 24 ) + self::mul( $a5, $b1, 24 ) + self::mul( $a6, $b0, 24 );
2114
+        $s7 = $c7 + self::mul( $a0, $b7, 24 ) + self::mul( $a1, $b6, 24 ) + self::mul( $a2, $b5, 24 ) + self::mul( $a3, $b4, 24 ) +
2115
+               self::mul( $a4, $b3, 24 ) + self::mul( $a5, $b2, 24 ) + self::mul( $a6, $b1, 24 ) + self::mul( $a7, $b0, 24 );
2116
+        $s8 = $c8 + self::mul( $a0, $b8, 24 ) + self::mul( $a1, $b7, 24 ) + self::mul( $a2, $b6, 24 ) + self::mul( $a3, $b5, 24 ) +
2117
+               self::mul( $a4, $b4, 24 ) + self::mul( $a5, $b3, 24 ) + self::mul( $a6, $b2, 24 ) + self::mul( $a7, $b1, 24 ) +
2118
+               self::mul( $a8, $b0, 24 );
2119
+        $s9 = $c9 + self::mul( $a0, $b9, 24 ) + self::mul( $a1, $b8, 24 ) + self::mul( $a2, $b7, 24 ) + self::mul( $a3, $b6, 24 ) +
2120
+               self::mul( $a4, $b5, 24 ) + self::mul( $a5, $b4, 24 ) + self::mul( $a6, $b3, 24 ) + self::mul( $a7, $b2, 24 ) +
2121
+               self::mul( $a8, $b1, 24 ) + self::mul( $a9, $b0, 24 );
2122
+        $s10 = $c10 + self::mul( $a0, $b10, 24 ) + self::mul( $a1, $b9, 24 ) + self::mul( $a2, $b8, 24 ) + self::mul( $a3, $b7, 24 ) +
2123
+               self::mul( $a4, $b6, 24 ) + self::mul( $a5, $b5, 24 ) + self::mul( $a6, $b4, 24 ) + self::mul( $a7, $b3, 24 ) +
2124
+               self::mul( $a8, $b2, 24 ) + self::mul( $a9, $b1, 24 ) + self::mul( $a10, $b0, 24 );
2125
+        $s11 = $c11 + self::mul( $a0, $b11, 24 ) + self::mul( $a1, $b10, 24 ) + self::mul( $a2, $b9, 24 ) + self::mul( $a3, $b8, 24 ) +
2126
+               self::mul( $a4, $b7, 24 ) + self::mul( $a5, $b6, 24 ) + self::mul( $a6, $b5, 24 ) + self::mul( $a7, $b4, 24 ) +
2127
+               self::mul( $a8, $b3, 24 ) + self::mul( $a9, $b2, 24 ) + self::mul( $a10, $b1, 24 ) + self::mul( $a11, $b0, 24 );
2128
+        $s12 = self::mul( $a1, $b11, 24 ) + self::mul( $a2, $b10, 24 ) + self::mul( $a3, $b9, 24 ) + self::mul( $a4, $b8, 24 ) +
2129
+               self::mul( $a5, $b7, 24 ) + self::mul( $a6, $b6, 24 ) + self::mul( $a7, $b5, 24 ) + self::mul( $a8, $b4, 24 ) +
2130
+               self::mul( $a9, $b3, 24 ) + self::mul( $a10, $b2, 24 ) + self::mul( $a11, $b1, 24 );
2131
+        $s13 = self::mul( $a2, $b11, 24 ) + self::mul( $a3, $b10, 24 ) + self::mul( $a4, $b9, 24 ) + self::mul( $a5, $b8, 24 ) +
2132
+               self::mul( $a6, $b7, 24 ) + self::mul( $a7, $b6, 24 ) + self::mul( $a8, $b5, 24 ) + self::mul( $a9, $b4, 24 ) +
2133
+               self::mul( $a10, $b3, 24 ) + self::mul( $a11, $b2, 24 );
2134
+        $s14 = self::mul( $a3, $b11, 24 ) + self::mul( $a4, $b10, 24 ) + self::mul( $a5, $b9, 24 ) + self::mul( $a6, $b8, 24 ) +
2135
+               self::mul( $a7, $b7, 24 ) + self::mul( $a8, $b6, 24 ) + self::mul( $a9, $b5, 24 ) + self::mul( $a10, $b4, 24 ) +
2136
+               self::mul( $a11, $b3, 24 );
2137
+        $s15 = self::mul( $a4, $b11, 24 ) + self::mul( $a5, $b10, 24 ) + self::mul( $a6, $b9, 24 ) + self::mul( $a7, $b8, 24 ) +
2138
+               self::mul( $a8, $b7, 24 ) + self::mul( $a9, $b6, 24 ) + self::mul( $a10, $b5, 24 ) + self::mul( $a11, $b4, 24 );
2139
+        $s16 = self::mul( $a5, $b11, 24 ) + self::mul( $a6, $b10, 24 ) + self::mul( $a7, $b9, 24 ) + self::mul( $a8, $b8, 24 ) +
2140
+               self::mul( $a9, $b7, 24 ) + self::mul( $a10, $b6, 24 ) + self::mul( $a11, $b5, 24 );
2141
+        $s17 = self::mul( $a6, $b11, 24 ) + self::mul( $a7, $b10, 24 ) + self::mul( $a8, $b9, 24 ) + self::mul( $a9, $b8, 24 ) +
2142
+               self::mul( $a10, $b7, 24 ) + self::mul( $a11, $b6, 24 );
2143
+        $s18 = self::mul( $a7, $b11, 24 ) + self::mul( $a8, $b10, 24 ) + self::mul( $a9, $b9, 24 ) + self::mul( $a10, $b8, 24 ) +
2144
+               self::mul( $a11, $b7, 24 );
2145
+        $s19 = self::mul( $a8, $b11, 24 ) + self::mul( $a9, $b10, 24 ) + self::mul( $a10, $b9, 24 ) + self::mul( $a11, $b8, 24 );
2146
+        $s20 = self::mul( $a9, $b11, 24 ) + self::mul( $a10, $b10, 24 ) + self::mul( $a11, $b9, 24 );
2147
+        $s21 = self::mul( $a10, $b11, 24 ) + self::mul( $a11, $b10, 24 );
2148
+        $s22 = self::mul( $a11, $b11, 24 );
2149 2149
         $s23 = 0;
2150 2150
 
2151
-        $carry0 = ($s0 + (1 << 20)) >> 21;
2151
+        $carry0 = ( $s0 + ( 1 << 20 ) ) >> 21;
2152 2152
         $s1 += $carry0;
2153 2153
         $s0 -= $carry0 << 21;
2154
-        $carry2 = ($s2 + (1 << 20)) >> 21;
2154
+        $carry2 = ( $s2 + ( 1 << 20 ) ) >> 21;
2155 2155
         $s3 += $carry2;
2156 2156
         $s2 -= $carry2 << 21;
2157
-        $carry4 = ($s4 + (1 << 20)) >> 21;
2157
+        $carry4 = ( $s4 + ( 1 << 20 ) ) >> 21;
2158 2158
         $s5 += $carry4;
2159 2159
         $s4 -= $carry4 << 21;
2160
-        $carry6 = ($s6 + (1 << 20)) >> 21;
2160
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
2161 2161
         $s7 += $carry6;
2162 2162
         $s6 -= $carry6 << 21;
2163
-        $carry8 = ($s8 + (1 << 20)) >> 21;
2163
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
2164 2164
         $s9 += $carry8;
2165 2165
         $s8 -= $carry8 << 21;
2166
-        $carry10 = ($s10 + (1 << 20)) >> 21;
2166
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
2167 2167
         $s11 += $carry10;
2168 2168
         $s10 -= $carry10 << 21;
2169
-        $carry12 = ($s12 + (1 << 20)) >> 21;
2169
+        $carry12 = ( $s12 + ( 1 << 20 ) ) >> 21;
2170 2170
         $s13 += $carry12;
2171 2171
         $s12 -= $carry12 << 21;
2172
-        $carry14 = ($s14 + (1 << 20)) >> 21;
2172
+        $carry14 = ( $s14 + ( 1 << 20 ) ) >> 21;
2173 2173
         $s15 += $carry14;
2174 2174
         $s14 -= $carry14 << 21;
2175
-        $carry16 = ($s16 + (1 << 20)) >> 21;
2175
+        $carry16 = ( $s16 + ( 1 << 20 ) ) >> 21;
2176 2176
         $s17 += $carry16;
2177 2177
         $s16 -= $carry16 << 21;
2178
-        $carry18 = ($s18 + (1 << 20)) >> 21;
2178
+        $carry18 = ( $s18 + ( 1 << 20 ) ) >> 21;
2179 2179
         $s19 += $carry18;
2180 2180
         $s18 -= $carry18 << 21;
2181
-        $carry20 = ($s20 + (1 << 20)) >> 21;
2181
+        $carry20 = ( $s20 + ( 1 << 20 ) ) >> 21;
2182 2182
         $s21 += $carry20;
2183 2183
         $s20 -= $carry20 << 21;
2184
-        $carry22 = ($s22 + (1 << 20)) >> 21;
2184
+        $carry22 = ( $s22 + ( 1 << 20 ) ) >> 21;
2185 2185
         $s23 += $carry22;
2186 2186
         $s22 -= $carry22 << 21;
2187 2187
 
2188
-        $carry1 = ($s1 + (1 << 20)) >> 21;
2188
+        $carry1 = ( $s1 + ( 1 << 20 ) ) >> 21;
2189 2189
         $s2 += $carry1;
2190 2190
         $s1 -= $carry1 << 21;
2191
-        $carry3 = ($s3 + (1 << 20)) >> 21;
2191
+        $carry3 = ( $s3 + ( 1 << 20 ) ) >> 21;
2192 2192
         $s4 += $carry3;
2193 2193
         $s3 -= $carry3 << 21;
2194
-        $carry5 = ($s5 + (1 << 20)) >> 21;
2194
+        $carry5 = ( $s5 + ( 1 << 20 ) ) >> 21;
2195 2195
         $s6 += $carry5;
2196 2196
         $s5 -= $carry5 << 21;
2197
-        $carry7 = ($s7 + (1 << 20)) >> 21;
2197
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
2198 2198
         $s8 += $carry7;
2199 2199
         $s7 -= $carry7 << 21;
2200
-        $carry9 = ($s9 + (1 << 20)) >> 21;
2200
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
2201 2201
         $s10 += $carry9;
2202 2202
         $s9 -= $carry9 << 21;
2203
-        $carry11 = ($s11 + (1 << 20)) >> 21;
2203
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
2204 2204
         $s12 += $carry11;
2205 2205
         $s11 -= $carry11 << 21;
2206
-        $carry13 = ($s13 + (1 << 20)) >> 21;
2206
+        $carry13 = ( $s13 + ( 1 << 20 ) ) >> 21;
2207 2207
         $s14 += $carry13;
2208 2208
         $s13 -= $carry13 << 21;
2209
-        $carry15 = ($s15 + (1 << 20)) >> 21;
2209
+        $carry15 = ( $s15 + ( 1 << 20 ) ) >> 21;
2210 2210
         $s16 += $carry15;
2211 2211
         $s15 -= $carry15 << 21;
2212
-        $carry17 = ($s17 + (1 << 20)) >> 21;
2212
+        $carry17 = ( $s17 + ( 1 << 20 ) ) >> 21;
2213 2213
         $s18 += $carry17;
2214 2214
         $s17 -= $carry17 << 21;
2215
-        $carry19 = ($s19 + (1 << 20)) >> 21;
2215
+        $carry19 = ( $s19 + ( 1 << 20 ) ) >> 21;
2216 2216
         $s20 += $carry19;
2217 2217
         $s19 -= $carry19 << 21;
2218
-        $carry21 = ($s21 + (1 << 20)) >> 21;
2218
+        $carry21 = ( $s21 + ( 1 << 20 ) ) >> 21;
2219 2219
         $s22 += $carry21;
2220 2220
         $s21 -= $carry21 << 21;
2221 2221
 
2222
-        $s11 += self::mul($s23, 666643, 20);
2223
-        $s12 += self::mul($s23, 470296, 19);
2224
-        $s13 += self::mul($s23, 654183, 20);
2225
-        $s14 -= self::mul($s23, 997805, 20);
2226
-        $s15 += self::mul($s23, 136657, 18);
2227
-        $s16 -= self::mul($s23, 683901, 20);
2228
-
2229
-        $s10 += self::mul($s22, 666643, 20);
2230
-        $s11 += self::mul($s22, 470296, 19);
2231
-        $s12 += self::mul($s22, 654183, 20);
2232
-        $s13 -= self::mul($s22, 997805, 20);
2233
-        $s14 += self::mul($s22, 136657, 18);
2234
-        $s15 -= self::mul($s22, 683901, 20);
2235
-
2236
-        $s9  += self::mul($s21,  666643, 20);
2237
-        $s10 += self::mul($s21,  470296, 19);
2238
-        $s11 += self::mul($s21,  654183, 20);
2239
-        $s12 -= self::mul($s21,  997805, 20);
2240
-        $s13 += self::mul($s21,  136657, 18);
2241
-        $s14 -= self::mul($s21,  683901, 20);
2242
-
2243
-        $s8  += self::mul($s20,  666643, 20);
2244
-        $s9  += self::mul($s20,  470296, 19);
2245
-        $s10 += self::mul($s20,  654183, 20);
2246
-        $s11 -= self::mul($s20,  997805, 20);
2247
-        $s12 += self::mul($s20,  136657, 18);
2248
-        $s13 -= self::mul($s20,  683901, 20);
2249
-
2250
-        $s7  += self::mul($s19,  666643, 20);
2251
-        $s8  += self::mul($s19,  470296, 19);
2252
-        $s9  += self::mul($s19,  654183, 20);
2253
-        $s10 -= self::mul($s19,  997805, 20);
2254
-        $s11 += self::mul($s19,  136657, 18);
2255
-        $s12 -= self::mul($s19,  683901, 20);
2256
-
2257
-        $s6  += self::mul($s18,  666643, 20);
2258
-        $s7  += self::mul($s18,  470296, 19);
2259
-        $s8  += self::mul($s18,  654183, 20);
2260
-        $s9  -= self::mul($s18,  997805, 20);
2261
-        $s10 += self::mul($s18,  136657, 18);
2262
-        $s11 -= self::mul($s18,  683901, 20);
2263
-
2264
-        $carry6 = ($s6 + (1 << 20)) >> 21;
2222
+        $s11 += self::mul( $s23, 666643, 20 );
2223
+        $s12 += self::mul( $s23, 470296, 19 );
2224
+        $s13 += self::mul( $s23, 654183, 20 );
2225
+        $s14 -= self::mul( $s23, 997805, 20 );
2226
+        $s15 += self::mul( $s23, 136657, 18 );
2227
+        $s16 -= self::mul( $s23, 683901, 20 );
2228
+
2229
+        $s10 += self::mul( $s22, 666643, 20 );
2230
+        $s11 += self::mul( $s22, 470296, 19 );
2231
+        $s12 += self::mul( $s22, 654183, 20 );
2232
+        $s13 -= self::mul( $s22, 997805, 20 );
2233
+        $s14 += self::mul( $s22, 136657, 18 );
2234
+        $s15 -= self::mul( $s22, 683901, 20 );
2235
+
2236
+        $s9  += self::mul( $s21, 666643, 20 );
2237
+        $s10 += self::mul( $s21, 470296, 19 );
2238
+        $s11 += self::mul( $s21, 654183, 20 );
2239
+        $s12 -= self::mul( $s21, 997805, 20 );
2240
+        $s13 += self::mul( $s21, 136657, 18 );
2241
+        $s14 -= self::mul( $s21, 683901, 20 );
2242
+
2243
+        $s8  += self::mul( $s20, 666643, 20 );
2244
+        $s9  += self::mul( $s20, 470296, 19 );
2245
+        $s10 += self::mul( $s20, 654183, 20 );
2246
+        $s11 -= self::mul( $s20, 997805, 20 );
2247
+        $s12 += self::mul( $s20, 136657, 18 );
2248
+        $s13 -= self::mul( $s20, 683901, 20 );
2249
+
2250
+        $s7  += self::mul( $s19, 666643, 20 );
2251
+        $s8  += self::mul( $s19, 470296, 19 );
2252
+        $s9  += self::mul( $s19, 654183, 20 );
2253
+        $s10 -= self::mul( $s19, 997805, 20 );
2254
+        $s11 += self::mul( $s19, 136657, 18 );
2255
+        $s12 -= self::mul( $s19, 683901, 20 );
2256
+
2257
+        $s6  += self::mul( $s18, 666643, 20 );
2258
+        $s7  += self::mul( $s18, 470296, 19 );
2259
+        $s8  += self::mul( $s18, 654183, 20 );
2260
+        $s9  -= self::mul( $s18, 997805, 20 );
2261
+        $s10 += self::mul( $s18, 136657, 18 );
2262
+        $s11 -= self::mul( $s18, 683901, 20 );
2263
+
2264
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
2265 2265
         $s7 += $carry6;
2266 2266
         $s6 -= $carry6 << 21;
2267
-        $carry8 = ($s8 + (1 << 20)) >> 21;
2267
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
2268 2268
         $s9 += $carry8;
2269 2269
         $s8 -= $carry8 << 21;
2270
-        $carry10 = ($s10 + (1 << 20)) >> 21;
2270
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
2271 2271
         $s11 += $carry10;
2272 2272
         $s10 -= $carry10 << 21;
2273
-        $carry12 = ($s12 + (1 << 20)) >> 21;
2273
+        $carry12 = ( $s12 + ( 1 << 20 ) ) >> 21;
2274 2274
         $s13 += $carry12;
2275 2275
         $s12 -= $carry12 << 21;
2276
-        $carry14 = ($s14 + (1 << 20)) >> 21;
2276
+        $carry14 = ( $s14 + ( 1 << 20 ) ) >> 21;
2277 2277
         $s15 += $carry14;
2278 2278
         $s14 -= $carry14 << 21;
2279
-        $carry16 = ($s16 + (1 << 20)) >> 21;
2279
+        $carry16 = ( $s16 + ( 1 << 20 ) ) >> 21;
2280 2280
         $s17 += $carry16;
2281 2281
         $s16 -= $carry16 << 21;
2282 2282
 
2283
-        $carry7 = ($s7 + (1 << 20)) >> 21;
2283
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
2284 2284
         $s8 += $carry7;
2285 2285
         $s7 -= $carry7 << 21;
2286
-        $carry9 = ($s9 + (1 << 20)) >> 21;
2286
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
2287 2287
         $s10 += $carry9;
2288 2288
         $s9 -= $carry9 << 21;
2289
-        $carry11 = ($s11 + (1 << 20)) >> 21;
2289
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
2290 2290
         $s12 += $carry11;
2291 2291
         $s11 -= $carry11 << 21;
2292
-        $carry13 = ($s13 + (1 << 20)) >> 21;
2292
+        $carry13 = ( $s13 + ( 1 << 20 ) ) >> 21;
2293 2293
         $s14 += $carry13;
2294 2294
         $s13 -= $carry13 << 21;
2295
-        $carry15 = ($s15 + (1 << 20)) >> 21;
2295
+        $carry15 = ( $s15 + ( 1 << 20 ) ) >> 21;
2296 2296
         $s16 += $carry15;
2297 2297
         $s15 -= $carry15 << 21;
2298 2298
 
2299
-        $s5  += self::mul($s17,  666643, 20);
2300
-        $s6  += self::mul($s17,  470296, 19);
2301
-        $s7  += self::mul($s17,  654183, 20);
2302
-        $s8  -= self::mul($s17,  997805, 20);
2303
-        $s9  += self::mul($s17,  136657, 18);
2304
-        $s10 -= self::mul($s17,  683901, 20);
2305
-
2306
-        $s4 += self::mul($s16,  666643, 20);
2307
-        $s5 += self::mul($s16,  470296, 19);
2308
-        $s6 += self::mul($s16,  654183, 20);
2309
-        $s7 -= self::mul($s16,  997805, 20);
2310
-        $s8 += self::mul($s16,  136657, 18);
2311
-        $s9 -= self::mul($s16,  683901, 20);
2312
-
2313
-        $s3 += self::mul($s15,  666643, 20);
2314
-        $s4 += self::mul($s15,  470296, 19);
2315
-        $s5 += self::mul($s15,  654183, 20);
2316
-        $s6 -= self::mul($s15,  997805, 20);
2317
-        $s7 += self::mul($s15,  136657, 18);
2318
-        $s8 -= self::mul($s15,  683901, 20);
2319
-
2320
-        $s2 += self::mul($s14,  666643, 20);
2321
-        $s3 += self::mul($s14,  470296, 19);
2322
-        $s4 += self::mul($s14,  654183, 20);
2323
-        $s5 -= self::mul($s14,  997805, 20);
2324
-        $s6 += self::mul($s14,  136657, 18);
2325
-        $s7 -= self::mul($s14,  683901, 20);
2326
-
2327
-        $s1 += self::mul($s13,  666643, 20);
2328
-        $s2 += self::mul($s13,  470296, 19);
2329
-        $s3 += self::mul($s13,  654183, 20);
2330
-        $s4 -= self::mul($s13,  997805, 20);
2331
-        $s5 += self::mul($s13,  136657, 18);
2332
-        $s6 -= self::mul($s13,  683901, 20);
2333
-
2334
-        $s0 += self::mul($s12,  666643, 20);
2335
-        $s1 += self::mul($s12,  470296, 19);
2336
-        $s2 += self::mul($s12,  654183, 20);
2337
-        $s3 -= self::mul($s12,  997805, 20);
2338
-        $s4 += self::mul($s12,  136657, 18);
2339
-        $s5 -= self::mul($s12,  683901, 20);
2299
+        $s5  += self::mul( $s17, 666643, 20 );
2300
+        $s6  += self::mul( $s17, 470296, 19 );
2301
+        $s7  += self::mul( $s17, 654183, 20 );
2302
+        $s8  -= self::mul( $s17, 997805, 20 );
2303
+        $s9  += self::mul( $s17, 136657, 18 );
2304
+        $s10 -= self::mul( $s17, 683901, 20 );
2305
+
2306
+        $s4 += self::mul( $s16, 666643, 20 );
2307
+        $s5 += self::mul( $s16, 470296, 19 );
2308
+        $s6 += self::mul( $s16, 654183, 20 );
2309
+        $s7 -= self::mul( $s16, 997805, 20 );
2310
+        $s8 += self::mul( $s16, 136657, 18 );
2311
+        $s9 -= self::mul( $s16, 683901, 20 );
2312
+
2313
+        $s3 += self::mul( $s15, 666643, 20 );
2314
+        $s4 += self::mul( $s15, 470296, 19 );
2315
+        $s5 += self::mul( $s15, 654183, 20 );
2316
+        $s6 -= self::mul( $s15, 997805, 20 );
2317
+        $s7 += self::mul( $s15, 136657, 18 );
2318
+        $s8 -= self::mul( $s15, 683901, 20 );
2319
+
2320
+        $s2 += self::mul( $s14, 666643, 20 );
2321
+        $s3 += self::mul( $s14, 470296, 19 );
2322
+        $s4 += self::mul( $s14, 654183, 20 );
2323
+        $s5 -= self::mul( $s14, 997805, 20 );
2324
+        $s6 += self::mul( $s14, 136657, 18 );
2325
+        $s7 -= self::mul( $s14, 683901, 20 );
2326
+
2327
+        $s1 += self::mul( $s13, 666643, 20 );
2328
+        $s2 += self::mul( $s13, 470296, 19 );
2329
+        $s3 += self::mul( $s13, 654183, 20 );
2330
+        $s4 -= self::mul( $s13, 997805, 20 );
2331
+        $s5 += self::mul( $s13, 136657, 18 );
2332
+        $s6 -= self::mul( $s13, 683901, 20 );
2333
+
2334
+        $s0 += self::mul( $s12, 666643, 20 );
2335
+        $s1 += self::mul( $s12, 470296, 19 );
2336
+        $s2 += self::mul( $s12, 654183, 20 );
2337
+        $s3 -= self::mul( $s12, 997805, 20 );
2338
+        $s4 += self::mul( $s12, 136657, 18 );
2339
+        $s5 -= self::mul( $s12, 683901, 20 );
2340 2340
         $s12 = 0;
2341 2341
 
2342
-        $carry0 = ($s0 + (1 << 20)) >> 21;
2342
+        $carry0 = ( $s0 + ( 1 << 20 ) ) >> 21;
2343 2343
         $s1 += $carry0;
2344 2344
         $s0 -= $carry0 << 21;
2345
-        $carry2 = ($s2 + (1 << 20)) >> 21;
2345
+        $carry2 = ( $s2 + ( 1 << 20 ) ) >> 21;
2346 2346
         $s3 += $carry2;
2347 2347
         $s2 -= $carry2 << 21;
2348
-        $carry4 = ($s4 + (1 << 20)) >> 21;
2348
+        $carry4 = ( $s4 + ( 1 << 20 ) ) >> 21;
2349 2349
         $s5 += $carry4;
2350 2350
         $s4 -= $carry4 << 21;
2351
-        $carry6 = ($s6 + (1 << 20)) >> 21;
2351
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
2352 2352
         $s7 += $carry6;
2353 2353
         $s6 -= $carry6 << 21;
2354
-        $carry8 = ($s8 + (1 << 20)) >> 21;
2354
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
2355 2355
         $s9 += $carry8;
2356 2356
         $s8 -= $carry8 << 21;
2357
-        $carry10 = ($s10 + (1 << 20)) >> 21;
2357
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
2358 2358
         $s11 += $carry10;
2359 2359
         $s10 -= $carry10 << 21;
2360 2360
 
2361
-        $carry1 = ($s1 + (1 << 20)) >> 21;
2361
+        $carry1 = ( $s1 + ( 1 << 20 ) ) >> 21;
2362 2362
         $s2 += $carry1;
2363 2363
         $s1 -= $carry1 << 21;
2364
-        $carry3 = ($s3 + (1 << 20)) >> 21;
2364
+        $carry3 = ( $s3 + ( 1 << 20 ) ) >> 21;
2365 2365
         $s4 += $carry3;
2366 2366
         $s3 -= $carry3 << 21;
2367
-        $carry5 = ($s5 + (1 << 20)) >> 21;
2367
+        $carry5 = ( $s5 + ( 1 << 20 ) ) >> 21;
2368 2368
         $s6 += $carry5;
2369 2369
         $s5 -= $carry5 << 21;
2370
-        $carry7 = ($s7 + (1 << 20)) >> 21;
2370
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
2371 2371
         $s8 += $carry7;
2372 2372
         $s7 -= $carry7 << 21;
2373
-        $carry9 = ($s9 + (1 << 20)) >> 21;
2373
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
2374 2374
         $s10 += $carry9;
2375 2375
         $s9 -= $carry9 << 21;
2376
-        $carry11 = ($s11 + (1 << 20)) >> 21;
2376
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
2377 2377
         $s12 += $carry11;
2378 2378
         $s11 -= $carry11 << 21;
2379 2379
 
2380
-        $s0 += self::mul($s12,  666643, 20);
2381
-        $s1 += self::mul($s12,  470296, 19);
2382
-        $s2 += self::mul($s12,  654183, 20);
2383
-        $s3 -= self::mul($s12,  997805, 20);
2384
-        $s4 += self::mul($s12,  136657, 18);
2385
-        $s5 -= self::mul($s12,  683901, 20);
2380
+        $s0 += self::mul( $s12, 666643, 20 );
2381
+        $s1 += self::mul( $s12, 470296, 19 );
2382
+        $s2 += self::mul( $s12, 654183, 20 );
2383
+        $s3 -= self::mul( $s12, 997805, 20 );
2384
+        $s4 += self::mul( $s12, 136657, 18 );
2385
+        $s5 -= self::mul( $s12, 683901, 20 );
2386 2386
         $s12 = 0;
2387 2387
 
2388 2388
         $carry0 = $s0 >> 21;
@@ -2422,12 +2422,12 @@  discard block
 block discarded – undo
2422 2422
         $s12 += $carry11;
2423 2423
         $s11 -= $carry11 << 21;
2424 2424
 
2425
-        $s0 += self::mul($s12,  666643, 20);
2426
-        $s1 += self::mul($s12,  470296, 19);
2427
-        $s2 += self::mul($s12,  654183, 20);
2428
-        $s3 -= self::mul($s12,  997805, 20);
2429
-        $s4 += self::mul($s12,  136657, 18);
2430
-        $s5 -= self::mul($s12,  683901, 20);
2425
+        $s0 += self::mul( $s12, 666643, 20 );
2426
+        $s1 += self::mul( $s12, 470296, 19 );
2427
+        $s2 += self::mul( $s12, 654183, 20 );
2428
+        $s3 -= self::mul( $s12, 997805, 20 );
2429
+        $s4 += self::mul( $s12, 136657, 18 );
2430
+        $s5 -= self::mul( $s12, 683901, 20 );
2431 2431
 
2432 2432
         $carry0 = $s0 >> 21;
2433 2433
         $s1 += $carry0;
@@ -2467,40 +2467,40 @@  discard block
 block discarded – undo
2467 2467
          * @var array<int, int>
2468 2468
          */
2469 2469
         $arr = array(
2470
-            (int) (0xff & ($s0 >> 0)),
2471
-            (int) (0xff & ($s0 >> 8)),
2472
-            (int) (0xff & (($s0 >> 16) | $s1 << 5)),
2473
-            (int) (0xff & ($s1 >> 3)),
2474
-            (int) (0xff & ($s1 >> 11)),
2475
-            (int) (0xff & (($s1 >> 19) | $s2 << 2)),
2476
-            (int) (0xff & ($s2 >> 6)),
2477
-            (int) (0xff & (($s2 >> 14) | $s3 << 7)),
2478
-            (int) (0xff & ($s3 >> 1)),
2479
-            (int) (0xff & ($s3 >> 9)),
2480
-            (int) (0xff & (($s3 >> 17) | $s4 << 4)),
2481
-            (int) (0xff & ($s4 >> 4)),
2482
-            (int) (0xff & ($s4 >> 12)),
2483
-            (int) (0xff & (($s4 >> 20) | $s5 << 1)),
2484
-            (int) (0xff & ($s5 >> 7)),
2485
-            (int) (0xff & (($s5 >> 15) | $s6 << 6)),
2486
-            (int) (0xff & ($s6 >> 2)),
2487
-            (int) (0xff & ($s6 >> 10)),
2488
-            (int) (0xff & (($s6 >> 18) | $s7 << 3)),
2489
-            (int) (0xff & ($s7 >> 5)),
2490
-            (int) (0xff & ($s7 >> 13)),
2491
-            (int) (0xff & ($s8 >> 0)),
2492
-            (int) (0xff & ($s8 >> 8)),
2493
-            (int) (0xff & (($s8 >> 16) | $s9 << 5)),
2494
-            (int) (0xff & ($s9 >> 3)),
2495
-            (int) (0xff & ($s9 >> 11)),
2496
-            (int) (0xff & (($s9 >> 19) | $s10 << 2)),
2497
-            (int) (0xff & ($s10 >> 6)),
2498
-            (int) (0xff & (($s10 >> 14) | $s11 << 7)),
2499
-            (int) (0xff & ($s11 >> 1)),
2500
-            (int) (0xff & ($s11 >> 9)),
2501
-            0xff & ($s11 >> 17)
2470
+            (int)( 0xff & ( $s0 >> 0 ) ),
2471
+            (int)( 0xff & ( $s0 >> 8 ) ),
2472
+            (int)( 0xff & ( ( $s0 >> 16 ) | $s1 << 5 ) ),
2473
+            (int)( 0xff & ( $s1 >> 3 ) ),
2474
+            (int)( 0xff & ( $s1 >> 11 ) ),
2475
+            (int)( 0xff & ( ( $s1 >> 19 ) | $s2 << 2 ) ),
2476
+            (int)( 0xff & ( $s2 >> 6 ) ),
2477
+            (int)( 0xff & ( ( $s2 >> 14 ) | $s3 << 7 ) ),
2478
+            (int)( 0xff & ( $s3 >> 1 ) ),
2479
+            (int)( 0xff & ( $s3 >> 9 ) ),
2480
+            (int)( 0xff & ( ( $s3 >> 17 ) | $s4 << 4 ) ),
2481
+            (int)( 0xff & ( $s4 >> 4 ) ),
2482
+            (int)( 0xff & ( $s4 >> 12 ) ),
2483
+            (int)( 0xff & ( ( $s4 >> 20 ) | $s5 << 1 ) ),
2484
+            (int)( 0xff & ( $s5 >> 7 ) ),
2485
+            (int)( 0xff & ( ( $s5 >> 15 ) | $s6 << 6 ) ),
2486
+            (int)( 0xff & ( $s6 >> 2 ) ),
2487
+            (int)( 0xff & ( $s6 >> 10 ) ),
2488
+            (int)( 0xff & ( ( $s6 >> 18 ) | $s7 << 3 ) ),
2489
+            (int)( 0xff & ( $s7 >> 5 ) ),
2490
+            (int)( 0xff & ( $s7 >> 13 ) ),
2491
+            (int)( 0xff & ( $s8 >> 0 ) ),
2492
+            (int)( 0xff & ( $s8 >> 8 ) ),
2493
+            (int)( 0xff & ( ( $s8 >> 16 ) | $s9 << 5 ) ),
2494
+            (int)( 0xff & ( $s9 >> 3 ) ),
2495
+            (int)( 0xff & ( $s9 >> 11 ) ),
2496
+            (int)( 0xff & ( ( $s9 >> 19 ) | $s10 << 2 ) ),
2497
+            (int)( 0xff & ( $s10 >> 6 ) ),
2498
+            (int)( 0xff & ( ( $s10 >> 14 ) | $s11 << 7 ) ),
2499
+            (int)( 0xff & ( $s11 >> 1 ) ),
2500
+            (int)( 0xff & ( $s11 >> 9 ) ),
2501
+            0xff & ( $s11 >> 17 )
2502 2502
         );
2503
-        return self::intArrayToString($arr);
2503
+        return self::intArrayToString( $arr );
2504 2504
     }
2505 2505
 
2506 2506
     /**
@@ -2510,197 +2510,197 @@  discard block
 block discarded – undo
2510 2510
      * @return string
2511 2511
      * @throws TypeError
2512 2512
      */
2513
-    public static function sc_reduce($s)
2513
+    public static function sc_reduce( $s )
2514 2514
     {
2515
-        $s0 = 2097151 & self::load_3(self::substr($s, 0, 3));
2516
-        $s1 = 2097151 & (self::load_4(self::substr($s, 2, 4)) >> 5);
2517
-        $s2 = 2097151 & (self::load_3(self::substr($s, 5, 3)) >> 2);
2518
-        $s3 = 2097151 & (self::load_4(self::substr($s, 7, 4)) >> 7);
2519
-        $s4 = 2097151 & (self::load_4(self::substr($s, 10, 4)) >> 4);
2520
-        $s5 = 2097151 & (self::load_3(self::substr($s, 13, 3)) >> 1);
2521
-        $s6 = 2097151 & (self::load_4(self::substr($s, 15, 4)) >> 6);
2522
-        $s7 = 2097151 & (self::load_3(self::substr($s, 18, 4)) >> 3);
2523
-        $s8 = 2097151 & self::load_3(self::substr($s, 21, 3));
2524
-        $s9 = 2097151 & (self::load_4(self::substr($s, 23, 4)) >> 5);
2525
-        $s10 = 2097151 & (self::load_3(self::substr($s, 26, 3)) >> 2);
2526
-        $s11 = 2097151 & (self::load_4(self::substr($s, 28, 4)) >> 7);
2527
-        $s12 = 2097151 & (self::load_4(self::substr($s, 31, 4)) >> 4);
2528
-        $s13 = 2097151 & (self::load_3(self::substr($s, 34, 3)) >> 1);
2529
-        $s14 = 2097151 & (self::load_4(self::substr($s, 36, 4)) >> 6);
2530
-        $s15 = 2097151 & (self::load_3(self::substr($s, 39, 4)) >> 3);
2531
-        $s16 = 2097151 & self::load_3(self::substr($s, 42, 3));
2532
-        $s17 = 2097151 & (self::load_4(self::substr($s, 44, 4)) >> 5);
2533
-        $s18 = 2097151 & (self::load_3(self::substr($s, 47, 3)) >> 2);
2534
-        $s19 = 2097151 & (self::load_4(self::substr($s, 49, 4)) >> 7);
2535
-        $s20 = 2097151 & (self::load_4(self::substr($s, 52, 4)) >> 4);
2536
-        $s21 = 2097151 & (self::load_3(self::substr($s, 55, 3)) >> 1);
2537
-        $s22 = 2097151 & (self::load_4(self::substr($s, 57, 4)) >> 6);
2538
-        $s23 = (self::load_4(self::substr($s, 60, 4)) >> 3);
2539
-
2540
-        $s11 += self::mul($s23,  666643, 20);
2541
-        $s12 += self::mul($s23,  470296, 19);
2542
-        $s13 += self::mul($s23,  654183, 20);
2543
-        $s14 -= self::mul($s23,  997805, 20);
2544
-        $s15 += self::mul($s23,  136657, 18);
2545
-        $s16 -= self::mul($s23,  683901, 20);
2546
-
2547
-        $s10 += self::mul($s22,  666643, 20);
2548
-        $s11 += self::mul($s22,  470296, 19);
2549
-        $s12 += self::mul($s22,  654183, 20);
2550
-        $s13 -= self::mul($s22,  997805, 20);
2551
-        $s14 += self::mul($s22,  136657, 18);
2552
-        $s15 -= self::mul($s22,  683901, 20);
2553
-
2554
-        $s9  += self::mul($s21,  666643, 20);
2555
-        $s10 += self::mul($s21,  470296, 19);
2556
-        $s11 += self::mul($s21,  654183, 20);
2557
-        $s12 -= self::mul($s21,  997805, 20);
2558
-        $s13 += self::mul($s21,  136657, 18);
2559
-        $s14 -= self::mul($s21,  683901, 20);
2560
-
2561
-        $s8  += self::mul($s20,  666643, 20);
2562
-        $s9  += self::mul($s20,  470296, 19);
2563
-        $s10 += self::mul($s20,  654183, 20);
2564
-        $s11 -= self::mul($s20,  997805, 20);
2565
-        $s12 += self::mul($s20,  136657, 18);
2566
-        $s13 -= self::mul($s20,  683901, 20);
2567
-
2568
-        $s7  += self::mul($s19,  666643, 20);
2569
-        $s8  += self::mul($s19,  470296, 19);
2570
-        $s9  += self::mul($s19,  654183, 20);
2571
-        $s10 -= self::mul($s19,  997805, 20);
2572
-        $s11 += self::mul($s19,  136657, 18);
2573
-        $s12 -= self::mul($s19,  683901, 20);
2574
-
2575
-        $s6  += self::mul($s18,  666643, 20);
2576
-        $s7  += self::mul($s18,  470296, 19);
2577
-        $s8  += self::mul($s18,  654183, 20);
2578
-        $s9  -= self::mul($s18,  997805, 20);
2579
-        $s10 += self::mul($s18,  136657, 18);
2580
-        $s11 -= self::mul($s18,  683901, 20);
2581
-
2582
-        $carry6 = ($s6 + (1 << 20)) >> 21;
2515
+        $s0 = 2097151 & self::load_3( self::substr( $s, 0, 3 ) );
2516
+        $s1 = 2097151 & ( self::load_4( self::substr( $s, 2, 4 ) ) >> 5 );
2517
+        $s2 = 2097151 & ( self::load_3( self::substr( $s, 5, 3 ) ) >> 2 );
2518
+        $s3 = 2097151 & ( self::load_4( self::substr( $s, 7, 4 ) ) >> 7 );
2519
+        $s4 = 2097151 & ( self::load_4( self::substr( $s, 10, 4 ) ) >> 4 );
2520
+        $s5 = 2097151 & ( self::load_3( self::substr( $s, 13, 3 ) ) >> 1 );
2521
+        $s6 = 2097151 & ( self::load_4( self::substr( $s, 15, 4 ) ) >> 6 );
2522
+        $s7 = 2097151 & ( self::load_3( self::substr( $s, 18, 4 ) ) >> 3 );
2523
+        $s8 = 2097151 & self::load_3( self::substr( $s, 21, 3 ) );
2524
+        $s9 = 2097151 & ( self::load_4( self::substr( $s, 23, 4 ) ) >> 5 );
2525
+        $s10 = 2097151 & ( self::load_3( self::substr( $s, 26, 3 ) ) >> 2 );
2526
+        $s11 = 2097151 & ( self::load_4( self::substr( $s, 28, 4 ) ) >> 7 );
2527
+        $s12 = 2097151 & ( self::load_4( self::substr( $s, 31, 4 ) ) >> 4 );
2528
+        $s13 = 2097151 & ( self::load_3( self::substr( $s, 34, 3 ) ) >> 1 );
2529
+        $s14 = 2097151 & ( self::load_4( self::substr( $s, 36, 4 ) ) >> 6 );
2530
+        $s15 = 2097151 & ( self::load_3( self::substr( $s, 39, 4 ) ) >> 3 );
2531
+        $s16 = 2097151 & self::load_3( self::substr( $s, 42, 3 ) );
2532
+        $s17 = 2097151 & ( self::load_4( self::substr( $s, 44, 4 ) ) >> 5 );
2533
+        $s18 = 2097151 & ( self::load_3( self::substr( $s, 47, 3 ) ) >> 2 );
2534
+        $s19 = 2097151 & ( self::load_4( self::substr( $s, 49, 4 ) ) >> 7 );
2535
+        $s20 = 2097151 & ( self::load_4( self::substr( $s, 52, 4 ) ) >> 4 );
2536
+        $s21 = 2097151 & ( self::load_3( self::substr( $s, 55, 3 ) ) >> 1 );
2537
+        $s22 = 2097151 & ( self::load_4( self::substr( $s, 57, 4 ) ) >> 6 );
2538
+        $s23 = ( self::load_4( self::substr( $s, 60, 4 ) ) >> 3 );
2539
+
2540
+        $s11 += self::mul( $s23, 666643, 20 );
2541
+        $s12 += self::mul( $s23, 470296, 19 );
2542
+        $s13 += self::mul( $s23, 654183, 20 );
2543
+        $s14 -= self::mul( $s23, 997805, 20 );
2544
+        $s15 += self::mul( $s23, 136657, 18 );
2545
+        $s16 -= self::mul( $s23, 683901, 20 );
2546
+
2547
+        $s10 += self::mul( $s22, 666643, 20 );
2548
+        $s11 += self::mul( $s22, 470296, 19 );
2549
+        $s12 += self::mul( $s22, 654183, 20 );
2550
+        $s13 -= self::mul( $s22, 997805, 20 );
2551
+        $s14 += self::mul( $s22, 136657, 18 );
2552
+        $s15 -= self::mul( $s22, 683901, 20 );
2553
+
2554
+        $s9  += self::mul( $s21, 666643, 20 );
2555
+        $s10 += self::mul( $s21, 470296, 19 );
2556
+        $s11 += self::mul( $s21, 654183, 20 );
2557
+        $s12 -= self::mul( $s21, 997805, 20 );
2558
+        $s13 += self::mul( $s21, 136657, 18 );
2559
+        $s14 -= self::mul( $s21, 683901, 20 );
2560
+
2561
+        $s8  += self::mul( $s20, 666643, 20 );
2562
+        $s9  += self::mul( $s20, 470296, 19 );
2563
+        $s10 += self::mul( $s20, 654183, 20 );
2564
+        $s11 -= self::mul( $s20, 997805, 20 );
2565
+        $s12 += self::mul( $s20, 136657, 18 );
2566
+        $s13 -= self::mul( $s20, 683901, 20 );
2567
+
2568
+        $s7  += self::mul( $s19, 666643, 20 );
2569
+        $s8  += self::mul( $s19, 470296, 19 );
2570
+        $s9  += self::mul( $s19, 654183, 20 );
2571
+        $s10 -= self::mul( $s19, 997805, 20 );
2572
+        $s11 += self::mul( $s19, 136657, 18 );
2573
+        $s12 -= self::mul( $s19, 683901, 20 );
2574
+
2575
+        $s6  += self::mul( $s18, 666643, 20 );
2576
+        $s7  += self::mul( $s18, 470296, 19 );
2577
+        $s8  += self::mul( $s18, 654183, 20 );
2578
+        $s9  -= self::mul( $s18, 997805, 20 );
2579
+        $s10 += self::mul( $s18, 136657, 18 );
2580
+        $s11 -= self::mul( $s18, 683901, 20 );
2581
+
2582
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
2583 2583
         $s7 += $carry6;
2584 2584
         $s6 -= $carry6 << 21;
2585
-        $carry8 = ($s8 + (1 << 20)) >> 21;
2585
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
2586 2586
         $s9 += $carry8;
2587 2587
         $s8 -= $carry8 << 21;
2588
-        $carry10 = ($s10 + (1 << 20)) >> 21;
2588
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
2589 2589
         $s11 += $carry10;
2590 2590
         $s10 -= $carry10 << 21;
2591
-        $carry12 = ($s12 + (1 << 20)) >> 21;
2591
+        $carry12 = ( $s12 + ( 1 << 20 ) ) >> 21;
2592 2592
         $s13 += $carry12;
2593 2593
         $s12 -= $carry12 << 21;
2594
-        $carry14 = ($s14 + (1 << 20)) >> 21;
2594
+        $carry14 = ( $s14 + ( 1 << 20 ) ) >> 21;
2595 2595
         $s15 += $carry14;
2596 2596
         $s14 -= $carry14 << 21;
2597
-        $carry16 = ($s16 + (1 << 20)) >> 21;
2597
+        $carry16 = ( $s16 + ( 1 << 20 ) ) >> 21;
2598 2598
         $s17 += $carry16;
2599 2599
         $s16 -= $carry16 << 21;
2600 2600
 
2601
-        $carry7 = ($s7 + (1 << 20)) >> 21;
2601
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
2602 2602
         $s8 += $carry7;
2603 2603
         $s7 -= $carry7 << 21;
2604
-        $carry9 = ($s9 + (1 << 20)) >> 21;
2604
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
2605 2605
         $s10 += $carry9;
2606 2606
         $s9 -= $carry9 << 21;
2607
-        $carry11 = ($s11 + (1 << 20)) >> 21;
2607
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
2608 2608
         $s12 += $carry11;
2609 2609
         $s11 -= $carry11 << 21;
2610
-        $carry13 = ($s13 + (1 << 20)) >> 21;
2610
+        $carry13 = ( $s13 + ( 1 << 20 ) ) >> 21;
2611 2611
         $s14 += $carry13;
2612 2612
         $s13 -= $carry13 << 21;
2613
-        $carry15 = ($s15 + (1 << 20)) >> 21;
2613
+        $carry15 = ( $s15 + ( 1 << 20 ) ) >> 21;
2614 2614
         $s16 += $carry15;
2615 2615
         $s15 -= $carry15 << 21;
2616 2616
 
2617
-        $s5  += self::mul($s17,  666643, 20);
2618
-        $s6  += self::mul($s17,  470296, 19);
2619
-        $s7  += self::mul($s17,  654183, 20);
2620
-        $s8  -= self::mul($s17,  997805, 20);
2621
-        $s9  += self::mul($s17,  136657, 18);
2622
-        $s10 -= self::mul($s17,  683901, 20);
2623
-
2624
-        $s4 += self::mul($s16,  666643, 20);
2625
-        $s5 += self::mul($s16,  470296, 19);
2626
-        $s6 += self::mul($s16,  654183, 20);
2627
-        $s7 -= self::mul($s16,  997805, 20);
2628
-        $s8 += self::mul($s16,  136657, 18);
2629
-        $s9 -= self::mul($s16,  683901, 20);
2630
-
2631
-        $s3 += self::mul($s15,  666643, 20);
2632
-        $s4 += self::mul($s15,  470296, 19);
2633
-        $s5 += self::mul($s15,  654183, 20);
2634
-        $s6 -= self::mul($s15,  997805, 20);
2635
-        $s7 += self::mul($s15,  136657, 18);
2636
-        $s8 -= self::mul($s15,  683901, 20);
2637
-
2638
-        $s2 += self::mul($s14,  666643, 20);
2639
-        $s3 += self::mul($s14,  470296, 19);
2640
-        $s4 += self::mul($s14,  654183, 20);
2641
-        $s5 -= self::mul($s14,  997805, 20);
2642
-        $s6 += self::mul($s14,  136657, 18);
2643
-        $s7 -= self::mul($s14,  683901, 20);
2644
-
2645
-        $s1 += self::mul($s13,  666643, 20);
2646
-        $s2 += self::mul($s13,  470296, 19);
2647
-        $s3 += self::mul($s13,  654183, 20);
2648
-        $s4 -= self::mul($s13,  997805, 20);
2649
-        $s5 += self::mul($s13,  136657, 18);
2650
-        $s6 -= self::mul($s13,  683901, 20);
2651
-
2652
-        $s0 += self::mul($s12,  666643, 20);
2653
-        $s1 += self::mul($s12,  470296, 19);
2654
-        $s2 += self::mul($s12,  654183, 20);
2655
-        $s3 -= self::mul($s12,  997805, 20);
2656
-        $s4 += self::mul($s12,  136657, 18);
2657
-        $s5 -= self::mul($s12,  683901, 20);
2617
+        $s5  += self::mul( $s17, 666643, 20 );
2618
+        $s6  += self::mul( $s17, 470296, 19 );
2619
+        $s7  += self::mul( $s17, 654183, 20 );
2620
+        $s8  -= self::mul( $s17, 997805, 20 );
2621
+        $s9  += self::mul( $s17, 136657, 18 );
2622
+        $s10 -= self::mul( $s17, 683901, 20 );
2623
+
2624
+        $s4 += self::mul( $s16, 666643, 20 );
2625
+        $s5 += self::mul( $s16, 470296, 19 );
2626
+        $s6 += self::mul( $s16, 654183, 20 );
2627
+        $s7 -= self::mul( $s16, 997805, 20 );
2628
+        $s8 += self::mul( $s16, 136657, 18 );
2629
+        $s9 -= self::mul( $s16, 683901, 20 );
2630
+
2631
+        $s3 += self::mul( $s15, 666643, 20 );
2632
+        $s4 += self::mul( $s15, 470296, 19 );
2633
+        $s5 += self::mul( $s15, 654183, 20 );
2634
+        $s6 -= self::mul( $s15, 997805, 20 );
2635
+        $s7 += self::mul( $s15, 136657, 18 );
2636
+        $s8 -= self::mul( $s15, 683901, 20 );
2637
+
2638
+        $s2 += self::mul( $s14, 666643, 20 );
2639
+        $s3 += self::mul( $s14, 470296, 19 );
2640
+        $s4 += self::mul( $s14, 654183, 20 );
2641
+        $s5 -= self::mul( $s14, 997805, 20 );
2642
+        $s6 += self::mul( $s14, 136657, 18 );
2643
+        $s7 -= self::mul( $s14, 683901, 20 );
2644
+
2645
+        $s1 += self::mul( $s13, 666643, 20 );
2646
+        $s2 += self::mul( $s13, 470296, 19 );
2647
+        $s3 += self::mul( $s13, 654183, 20 );
2648
+        $s4 -= self::mul( $s13, 997805, 20 );
2649
+        $s5 += self::mul( $s13, 136657, 18 );
2650
+        $s6 -= self::mul( $s13, 683901, 20 );
2651
+
2652
+        $s0 += self::mul( $s12, 666643, 20 );
2653
+        $s1 += self::mul( $s12, 470296, 19 );
2654
+        $s2 += self::mul( $s12, 654183, 20 );
2655
+        $s3 -= self::mul( $s12, 997805, 20 );
2656
+        $s4 += self::mul( $s12, 136657, 18 );
2657
+        $s5 -= self::mul( $s12, 683901, 20 );
2658 2658
         $s12 = 0;
2659 2659
 
2660
-        $carry0 = ($s0 + (1 << 20)) >> 21;
2660
+        $carry0 = ( $s0 + ( 1 << 20 ) ) >> 21;
2661 2661
         $s1 += $carry0;
2662 2662
         $s0 -= $carry0 << 21;
2663
-        $carry2 = ($s2 + (1 << 20)) >> 21;
2663
+        $carry2 = ( $s2 + ( 1 << 20 ) ) >> 21;
2664 2664
         $s3 += $carry2;
2665 2665
         $s2 -= $carry2 << 21;
2666
-        $carry4 = ($s4 + (1 << 20)) >> 21;
2666
+        $carry4 = ( $s4 + ( 1 << 20 ) ) >> 21;
2667 2667
         $s5 += $carry4;
2668 2668
         $s4 -= $carry4 << 21;
2669
-        $carry6 = ($s6 + (1 << 20)) >> 21;
2669
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
2670 2670
         $s7 += $carry6;
2671 2671
         $s6 -= $carry6 << 21;
2672
-        $carry8 = ($s8 + (1 << 20)) >> 21;
2672
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
2673 2673
         $s9 += $carry8;
2674 2674
         $s8 -= $carry8 << 21;
2675
-        $carry10 = ($s10 + (1 << 20)) >> 21;
2675
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
2676 2676
         $s11 += $carry10;
2677 2677
         $s10 -= $carry10 << 21;
2678 2678
 
2679
-        $carry1 = ($s1 + (1 << 20)) >> 21;
2679
+        $carry1 = ( $s1 + ( 1 << 20 ) ) >> 21;
2680 2680
         $s2 += $carry1;
2681 2681
         $s1 -= $carry1 << 21;
2682
-        $carry3 = ($s3 + (1 << 20)) >> 21;
2682
+        $carry3 = ( $s3 + ( 1 << 20 ) ) >> 21;
2683 2683
         $s4 += $carry3;
2684 2684
         $s3 -= $carry3 << 21;
2685
-        $carry5 = ($s5 + (1 << 20)) >> 21;
2685
+        $carry5 = ( $s5 + ( 1 << 20 ) ) >> 21;
2686 2686
         $s6 += $carry5;
2687 2687
         $s5 -= $carry5 << 21;
2688
-        $carry7 = ($s7 + (1 << 20)) >> 21;
2688
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
2689 2689
         $s8 += $carry7;
2690 2690
         $s7 -= $carry7 << 21;
2691
-        $carry9 = ($s9 + (1 << 20)) >> 21;
2691
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
2692 2692
         $s10 += $carry9;
2693 2693
         $s9 -= $carry9 << 21;
2694
-        $carry11 = ($s11 + (1 << 20)) >> 21;
2694
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
2695 2695
         $s12 += $carry11;
2696 2696
         $s11 -= $carry11 << 21;
2697 2697
 
2698
-        $s0 += self::mul($s12,  666643, 20);
2699
-        $s1 += self::mul($s12,  470296, 19);
2700
-        $s2 += self::mul($s12,  654183, 20);
2701
-        $s3 -= self::mul($s12,  997805, 20);
2702
-        $s4 += self::mul($s12,  136657, 18);
2703
-        $s5 -= self::mul($s12,  683901, 20);
2698
+        $s0 += self::mul( $s12, 666643, 20 );
2699
+        $s1 += self::mul( $s12, 470296, 19 );
2700
+        $s2 += self::mul( $s12, 654183, 20 );
2701
+        $s3 -= self::mul( $s12, 997805, 20 );
2702
+        $s4 += self::mul( $s12, 136657, 18 );
2703
+        $s5 -= self::mul( $s12, 683901, 20 );
2704 2704
         $s12 = 0;
2705 2705
 
2706 2706
         $carry0 = $s0 >> 21;
@@ -2740,12 +2740,12 @@  discard block
 block discarded – undo
2740 2740
         $s12 += $carry11;
2741 2741
         $s11 -= $carry11 << 21;
2742 2742
 
2743
-        $s0 += self::mul($s12,  666643, 20);
2744
-        $s1 += self::mul($s12,  470296, 19);
2745
-        $s2 += self::mul($s12,  654183, 20);
2746
-        $s3 -= self::mul($s12,  997805, 20);
2747
-        $s4 += self::mul($s12,  136657, 18);
2748
-        $s5 -= self::mul($s12,  683901, 20);
2743
+        $s0 += self::mul( $s12, 666643, 20 );
2744
+        $s1 += self::mul( $s12, 470296, 19 );
2745
+        $s2 += self::mul( $s12, 654183, 20 );
2746
+        $s3 -= self::mul( $s12, 997805, 20 );
2747
+        $s4 += self::mul( $s12, 136657, 18 );
2748
+        $s5 -= self::mul( $s12, 683901, 20 );
2749 2749
 
2750 2750
         $carry0 = $s0 >> 21;
2751 2751
         $s1 += $carry0;
@@ -2785,40 +2785,40 @@  discard block
 block discarded – undo
2785 2785
          * @var array<int, int>
2786 2786
          */
2787 2787
         $arr = array(
2788
-            (int) ($s0 >> 0),
2789
-            (int) ($s0 >> 8),
2790
-            (int) (($s0 >> 16) | $s1 << 5),
2791
-            (int) ($s1 >> 3),
2792
-            (int) ($s1 >> 11),
2793
-            (int) (($s1 >> 19) | $s2 << 2),
2794
-            (int) ($s2 >> 6),
2795
-            (int) (($s2 >> 14) | $s3 << 7),
2796
-            (int) ($s3 >> 1),
2797
-            (int) ($s3 >> 9),
2798
-            (int) (($s3 >> 17) | $s4 << 4),
2799
-            (int) ($s4 >> 4),
2800
-            (int) ($s4 >> 12),
2801
-            (int) (($s4 >> 20) | $s5 << 1),
2802
-            (int) ($s5 >> 7),
2803
-            (int) (($s5 >> 15) | $s6 << 6),
2804
-            (int) ($s6 >> 2),
2805
-            (int) ($s6 >> 10),
2806
-            (int) (($s6 >> 18) | $s7 << 3),
2807
-            (int) ($s7 >> 5),
2808
-            (int) ($s7 >> 13),
2809
-            (int) ($s8 >> 0),
2810
-            (int) ($s8 >> 8),
2811
-            (int) (($s8 >> 16) | $s9 << 5),
2812
-            (int) ($s9 >> 3),
2813
-            (int) ($s9 >> 11),
2814
-            (int) (($s9 >> 19) | $s10 << 2),
2815
-            (int) ($s10 >> 6),
2816
-            (int) (($s10 >> 14) | $s11 << 7),
2817
-            (int) ($s11 >> 1),
2818
-            (int) ($s11 >> 9),
2819
-            (int) $s11 >> 17
2788
+            (int)( $s0 >> 0 ),
2789
+            (int)( $s0 >> 8 ),
2790
+            (int)( ( $s0 >> 16 ) | $s1 << 5 ),
2791
+            (int)( $s1 >> 3 ),
2792
+            (int)( $s1 >> 11 ),
2793
+            (int)( ( $s1 >> 19 ) | $s2 << 2 ),
2794
+            (int)( $s2 >> 6 ),
2795
+            (int)( ( $s2 >> 14 ) | $s3 << 7 ),
2796
+            (int)( $s3 >> 1 ),
2797
+            (int)( $s3 >> 9 ),
2798
+            (int)( ( $s3 >> 17 ) | $s4 << 4 ),
2799
+            (int)( $s4 >> 4 ),
2800
+            (int)( $s4 >> 12 ),
2801
+            (int)( ( $s4 >> 20 ) | $s5 << 1 ),
2802
+            (int)( $s5 >> 7 ),
2803
+            (int)( ( $s5 >> 15 ) | $s6 << 6 ),
2804
+            (int)( $s6 >> 2 ),
2805
+            (int)( $s6 >> 10 ),
2806
+            (int)( ( $s6 >> 18 ) | $s7 << 3 ),
2807
+            (int)( $s7 >> 5 ),
2808
+            (int)( $s7 >> 13 ),
2809
+            (int)( $s8 >> 0 ),
2810
+            (int)( $s8 >> 8 ),
2811
+            (int)( ( $s8 >> 16 ) | $s9 << 5 ),
2812
+            (int)( $s9 >> 3 ),
2813
+            (int)( $s9 >> 11 ),
2814
+            (int)( ( $s9 >> 19 ) | $s10 << 2 ),
2815
+            (int)( $s10 >> 6 ),
2816
+            (int)( ( $s10 >> 14 ) | $s11 << 7 ),
2817
+            (int)( $s11 >> 1 ),
2818
+            (int)( $s11 >> 9 ),
2819
+            (int)$s11 >> 17
2820 2820
         );
2821
-        return self::intArrayToString($arr);
2821
+        return self::intArrayToString( $arr );
2822 2822
     }
2823 2823
 
2824 2824
     /**
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
      * @param ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A
2828 2828
      * @return ParagonIE_Sodium_Core_Curve25519_Ge_P3
2829 2829
      */
2830
-    public static function ge_mul_l(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A)
2830
+    public static function ge_mul_l( ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A )
2831 2831
     {
2832 2832
         $aslide = array(
2833 2833
             13, 0, 0, 0, 0, -1, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0,
@@ -2848,39 +2848,39 @@  discard block
 block discarded – undo
2848 2848
         $Ai = array();
2849 2849
 
2850 2850
         # ge_p3_to_cached(&Ai[0], A);
2851
-        $Ai[0] = self::ge_p3_to_cached($A);
2851
+        $Ai[ 0 ] = self::ge_p3_to_cached( $A );
2852 2852
         # ge_p3_dbl(&t, A);
2853
-        $t = self::ge_p3_dbl($A);
2853
+        $t = self::ge_p3_dbl( $A );
2854 2854
         # ge_p1p1_to_p3(&A2, &t);
2855
-        $A2 = self::ge_p1p1_to_p3($t);
2855
+        $A2 = self::ge_p1p1_to_p3( $t );
2856 2856
 
2857
-        for ($i = 1; $i < 8; ++$i) {
2857
+        for ( $i = 1; $i < 8; ++$i ) {
2858 2858
             # ge_add(&t, &A2, &Ai[0]);
2859
-            $t = self::ge_add($A2, $Ai[$i - 1]);
2859
+            $t = self::ge_add( $A2, $Ai[ $i - 1 ] );
2860 2860
             # ge_p1p1_to_p3(&u, &t);
2861
-            $u = self::ge_p1p1_to_p3($t);
2861
+            $u = self::ge_p1p1_to_p3( $t );
2862 2862
             # ge_p3_to_cached(&Ai[i], &u);
2863
-            $Ai[$i] = self::ge_p3_to_cached($u);
2863
+            $Ai[ $i ] = self::ge_p3_to_cached( $u );
2864 2864
         }
2865 2865
 
2866 2866
         $r = self::ge_p3_0();
2867
-        for ($i = 252; $i >= 0; --$i) {
2868
-            $t = self::ge_p3_dbl($r);
2869
-            if ($aslide[$i] > 0) {
2867
+        for ( $i = 252; $i >= 0; --$i ) {
2868
+            $t = self::ge_p3_dbl( $r );
2869
+            if ( $aslide[ $i ] > 0 ) {
2870 2870
                 # ge_p1p1_to_p3(&u, &t);
2871
-                $u = self::ge_p1p1_to_p3($t);
2871
+                $u = self::ge_p1p1_to_p3( $t );
2872 2872
                 # ge_add(&t, &u, &Ai[aslide[i] / 2]);
2873
-                $t = self::ge_add($u, $Ai[(int)($aslide[$i] / 2)]);
2874
-            } elseif ($aslide[$i] < 0) {
2873
+                $t = self::ge_add( $u, $Ai[ (int)( $aslide[ $i ] / 2 ) ] );
2874
+            } elseif ( $aslide[ $i ] < 0 ) {
2875 2875
                 # ge_p1p1_to_p3(&u, &t);
2876
-                $u = self::ge_p1p1_to_p3($t);
2876
+                $u = self::ge_p1p1_to_p3( $t );
2877 2877
                 # ge_sub(&t, &u, &Ai[(-aslide[i]) / 2]);
2878
-                $t = self::ge_sub($u, $Ai[(int)(-$aslide[$i] / 2)]);
2878
+                $t = self::ge_sub( $u, $Ai[ (int)(-$aslide[ $i ] / 2) ] );
2879 2879
             }
2880 2880
         }
2881 2881
 
2882 2882
         # ge_p1p1_to_p3(r, &t);
2883
-        return self::ge_p1p1_to_p3($t);
2883
+        return self::ge_p1p1_to_p3( $t );
2884 2884
     }
2885 2885
 
2886 2886
     /**
@@ -2888,7 +2888,7 @@  discard block
 block discarded – undo
2888 2888
      * @param string $b
2889 2889
      * @return string
2890 2890
      */
2891
-    public static function sc25519_mul($a, $b)
2891
+    public static function sc25519_mul( $a, $b )
2892 2892
     {
2893 2893
         //    int64_t a0  = 2097151 & load_3(a);
2894 2894
         //    int64_t a1  = 2097151 & (load_4(a + 2) >> 5);
@@ -2902,18 +2902,18 @@  discard block
 block discarded – undo
2902 2902
         //    int64_t a9  = 2097151 & (load_4(a + 23) >> 5);
2903 2903
         //    int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
2904 2904
         //    int64_t a11 = (load_4(a + 28) >> 7);
2905
-        $a0  = 2097151 &  self::load_3(self::substr($a, 0, 3));
2906
-        $a1  = 2097151 & (self::load_4(self::substr($a, 2, 4)) >> 5);
2907
-        $a2  = 2097151 & (self::load_3(self::substr($a, 5, 3)) >> 2);
2908
-        $a3  = 2097151 & (self::load_4(self::substr($a, 7, 4)) >> 7);
2909
-        $a4  = 2097151 & (self::load_4(self::substr($a, 10, 4)) >> 4);
2910
-        $a5  = 2097151 & (self::load_3(self::substr($a, 13, 3)) >> 1);
2911
-        $a6  = 2097151 & (self::load_4(self::substr($a, 15, 4)) >> 6);
2912
-        $a7  = 2097151 & (self::load_3(self::substr($a, 18, 3)) >> 3);
2913
-        $a8  = 2097151 &  self::load_3(self::substr($a, 21, 3));
2914
-        $a9  = 2097151 & (self::load_4(self::substr($a, 23, 4)) >> 5);
2915
-        $a10 = 2097151 & (self::load_3(self::substr($a, 26, 3)) >> 2);
2916
-        $a11 = (self::load_4(self::substr($a, 28, 4)) >> 7);
2905
+        $a0  = 2097151 &  self::load_3( self::substr( $a, 0, 3 ) );
2906
+        $a1  = 2097151 & ( self::load_4( self::substr( $a, 2, 4 ) ) >> 5 );
2907
+        $a2  = 2097151 & ( self::load_3( self::substr( $a, 5, 3 ) ) >> 2 );
2908
+        $a3  = 2097151 & ( self::load_4( self::substr( $a, 7, 4 ) ) >> 7 );
2909
+        $a4  = 2097151 & ( self::load_4( self::substr( $a, 10, 4 ) ) >> 4 );
2910
+        $a5  = 2097151 & ( self::load_3( self::substr( $a, 13, 3 ) ) >> 1 );
2911
+        $a6  = 2097151 & ( self::load_4( self::substr( $a, 15, 4 ) ) >> 6 );
2912
+        $a7  = 2097151 & ( self::load_3( self::substr( $a, 18, 3 ) ) >> 3 );
2913
+        $a8  = 2097151 &  self::load_3( self::substr( $a, 21, 3 ) );
2914
+        $a9  = 2097151 & ( self::load_4( self::substr( $a, 23, 4 ) ) >> 5 );
2915
+        $a10 = 2097151 & ( self::load_3( self::substr( $a, 26, 3 ) ) >> 2 );
2916
+        $a11 = ( self::load_4( self::substr( $a, 28, 4 ) ) >> 7 );
2917 2917
 
2918 2918
         //    int64_t b0  = 2097151 & load_3(b);
2919 2919
         //    int64_t b1  = 2097151 & (load_4(b + 2) >> 5);
@@ -2927,18 +2927,18 @@  discard block
 block discarded – undo
2927 2927
         //    int64_t b9  = 2097151 & (load_4(b + 23) >> 5);
2928 2928
         //    int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
2929 2929
         //    int64_t b11 = (load_4(b + 28) >> 7);
2930
-        $b0  = 2097151 &  self::load_3(self::substr($b, 0, 3));
2931
-        $b1  = 2097151 & (self::load_4(self::substr($b, 2, 4)) >> 5);
2932
-        $b2  = 2097151 & (self::load_3(self::substr($b, 5, 3)) >> 2);
2933
-        $b3  = 2097151 & (self::load_4(self::substr($b, 7, 4)) >> 7);
2934
-        $b4  = 2097151 & (self::load_4(self::substr($b, 10, 4)) >> 4);
2935
-        $b5  = 2097151 & (self::load_3(self::substr($b, 13, 3)) >> 1);
2936
-        $b6  = 2097151 & (self::load_4(self::substr($b, 15, 4)) >> 6);
2937
-        $b7  = 2097151 & (self::load_3(self::substr($b, 18, 3)) >> 3);
2938
-        $b8  = 2097151 &  self::load_3(self::substr($b, 21, 3));
2939
-        $b9  = 2097151 & (self::load_4(self::substr($b, 23, 4)) >> 5);
2940
-        $b10 = 2097151 & (self::load_3(self::substr($b, 26, 3)) >> 2);
2941
-        $b11 = (self::load_4(self::substr($b, 28, 4)) >> 7);
2930
+        $b0  = 2097151 &  self::load_3( self::substr( $b, 0, 3 ) );
2931
+        $b1  = 2097151 & ( self::load_4( self::substr( $b, 2, 4 ) ) >> 5 );
2932
+        $b2  = 2097151 & ( self::load_3( self::substr( $b, 5, 3 ) ) >> 2 );
2933
+        $b3  = 2097151 & ( self::load_4( self::substr( $b, 7, 4 ) ) >> 7 );
2934
+        $b4  = 2097151 & ( self::load_4( self::substr( $b, 10, 4 ) ) >> 4 );
2935
+        $b5  = 2097151 & ( self::load_3( self::substr( $b, 13, 3 ) ) >> 1 );
2936
+        $b6  = 2097151 & ( self::load_4( self::substr( $b, 15, 4 ) ) >> 6 );
2937
+        $b7  = 2097151 & ( self::load_3( self::substr( $b, 18, 3 ) ) >> 3 );
2938
+        $b8  = 2097151 &  self::load_3( self::substr( $b, 21, 3 ) );
2939
+        $b9  = 2097151 & ( self::load_4( self::substr( $b, 23, 4 ) ) >> 5 );
2940
+        $b10 = 2097151 & ( self::load_3( self::substr( $b, 26, 3 ) ) >> 2 );
2941
+        $b11 = ( self::load_4( self::substr( $b, 28, 4 ) ) >> 7 );
2942 2942
 
2943 2943
         //    s0 = a0 * b0;
2944 2944
         //    s1 = a0 * b1 + a1 * b0;
@@ -2974,192 +2974,192 @@  discard block
 block discarded – undo
2974 2974
         //    s21 = a10 * b11 + a11 * b10;
2975 2975
         //    s22 = a11 * b11;
2976 2976
         //    s23 = 0;
2977
-        $s0 = self::mul($a0, $b0, 22);
2978
-        $s1 = self::mul($a0, $b1, 22) + self::mul($a1, $b0, 22);
2979
-        $s2 = self::mul($a0, $b2, 22) + self::mul($a1, $b1, 22) + self::mul($a2, $b0, 22);
2980
-        $s3 = self::mul($a0, $b3, 22) + self::mul($a1, $b2, 22) + self::mul($a2, $b1, 22) + self::mul($a3, $b0, 22);
2981
-        $s4 = self::mul($a0, $b4, 22) + self::mul($a1, $b3, 22) + self::mul($a2, $b2, 22) + self::mul($a3, $b1, 22) +
2982
-            self::mul($a4, $b0, 22);
2983
-        $s5 = self::mul($a0, $b5, 22) + self::mul($a1, $b4, 22) + self::mul($a2, $b3, 22) + self::mul($a3, $b2, 22) +
2984
-            self::mul($a4, $b1, 22) + self::mul($a5, $b0, 22);
2985
-        $s6 = self::mul($a0, $b6, 22) + self::mul($a1, $b5, 22) + self::mul($a2, $b4, 22) + self::mul($a3, $b3, 22) +
2986
-            self::mul($a4, $b2, 22) + self::mul($a5, $b1, 22) + self::mul($a6, $b0, 22);
2987
-        $s7 = self::mul($a0, $b7, 22) + self::mul($a1, $b6, 22) + self::mul($a2, $b5, 22) + self::mul($a3, $b4, 22) +
2988
-            self::mul($a4, $b3, 22) + self::mul($a5, $b2, 22) + self::mul($a6, $b1, 22) + self::mul($a7, $b0, 22);
2989
-        $s8 = self::mul($a0, $b8, 22) + self::mul($a1, $b7, 22) + self::mul($a2, $b6, 22) + self::mul($a3, $b5, 22) +
2990
-            self::mul($a4, $b4, 22) + self::mul($a5, $b3, 22) + self::mul($a6, $b2, 22) + self::mul($a7, $b1, 22) +
2991
-            self::mul($a8, $b0, 22);
2992
-        $s9 = self::mul($a0, $b9, 22) + self::mul($a1, $b8, 22) + self::mul($a2, $b7, 22) + self::mul($a3, $b6, 22) +
2993
-            self::mul($a4, $b5, 22) + self::mul($a5, $b4, 22) + self::mul($a6, $b3, 22) + self::mul($a7, $b2, 22) +
2994
-            self::mul($a8, $b1, 22) + self::mul($a9, $b0, 22);
2995
-        $s10 = self::mul($a0, $b10, 22) + self::mul($a1, $b9, 22) + self::mul($a2, $b8, 22) + self::mul($a3, $b7, 22) +
2996
-            self::mul($a4, $b6, 22) + self::mul($a5, $b5, 22) + self::mul($a6, $b4, 22) + self::mul($a7, $b3, 22) +
2997
-            self::mul($a8, $b2, 22) + self::mul($a9, $b1, 22) + self::mul($a10, $b0, 22);
2998
-        $s11 = self::mul($a0, $b11, 22) + self::mul($a1, $b10, 22) + self::mul($a2, $b9, 22) + self::mul($a3, $b8, 22) +
2999
-            self::mul($a4, $b7, 22) + self::mul($a5, $b6, 22) + self::mul($a6, $b5, 22) + self::mul($a7, $b4, 22) +
3000
-            self::mul($a8, $b3, 22) + self::mul($a9, $b2, 22) + self::mul($a10, $b1, 22) + self::mul($a11, $b0, 22);
3001
-        $s12 = self::mul($a1, $b11, 22) + self::mul($a2, $b10, 22) + self::mul($a3, $b9, 22) + self::mul($a4, $b8, 22) +
3002
-            self::mul($a5, $b7, 22) + self::mul($a6, $b6, 22) + self::mul($a7, $b5, 22) + self::mul($a8, $b4, 22) +
3003
-            self::mul($a9, $b3, 22) + self::mul($a10, $b2, 22) + self::mul($a11, $b1, 22);
3004
-        $s13 = self::mul($a2, $b11, 22) + self::mul($a3, $b10, 22) + self::mul($a4, $b9, 22) + self::mul($a5, $b8, 22) +
3005
-            self::mul($a6, $b7, 22) + self::mul($a7, $b6, 22) + self::mul($a8, $b5, 22) + self::mul($a9, $b4, 22) +
3006
-            self::mul($a10, $b3, 22) + self::mul($a11, $b2, 22);
3007
-        $s14 = self::mul($a3, $b11, 22) + self::mul($a4, $b10, 22) + self::mul($a5, $b9, 22) + self::mul($a6, $b8, 22) +
3008
-            self::mul($a7, $b7, 22) + self::mul($a8, $b6, 22) + self::mul($a9, $b5, 22) + self::mul($a10, $b4, 22) +
3009
-            self::mul($a11, $b3, 22);
3010
-        $s15 = self::mul($a4, $b11, 22) + self::mul($a5, $b10, 22) + self::mul($a6, $b9, 22) + self::mul($a7, $b8, 22) +
3011
-            self::mul($a8, $b7, 22) + self::mul($a9, $b6, 22) + self::mul($a10, $b5, 22) + self::mul($a11, $b4, 22);
2977
+        $s0 = self::mul( $a0, $b0, 22 );
2978
+        $s1 = self::mul( $a0, $b1, 22 ) + self::mul( $a1, $b0, 22 );
2979
+        $s2 = self::mul( $a0, $b2, 22 ) + self::mul( $a1, $b1, 22 ) + self::mul( $a2, $b0, 22 );
2980
+        $s3 = self::mul( $a0, $b3, 22 ) + self::mul( $a1, $b2, 22 ) + self::mul( $a2, $b1, 22 ) + self::mul( $a3, $b0, 22 );
2981
+        $s4 = self::mul( $a0, $b4, 22 ) + self::mul( $a1, $b3, 22 ) + self::mul( $a2, $b2, 22 ) + self::mul( $a3, $b1, 22 ) +
2982
+            self::mul( $a4, $b0, 22 );
2983
+        $s5 = self::mul( $a0, $b5, 22 ) + self::mul( $a1, $b4, 22 ) + self::mul( $a2, $b3, 22 ) + self::mul( $a3, $b2, 22 ) +
2984
+            self::mul( $a4, $b1, 22 ) + self::mul( $a5, $b0, 22 );
2985
+        $s6 = self::mul( $a0, $b6, 22 ) + self::mul( $a1, $b5, 22 ) + self::mul( $a2, $b4, 22 ) + self::mul( $a3, $b3, 22 ) +
2986
+            self::mul( $a4, $b2, 22 ) + self::mul( $a5, $b1, 22 ) + self::mul( $a6, $b0, 22 );
2987
+        $s7 = self::mul( $a0, $b7, 22 ) + self::mul( $a1, $b6, 22 ) + self::mul( $a2, $b5, 22 ) + self::mul( $a3, $b4, 22 ) +
2988
+            self::mul( $a4, $b3, 22 ) + self::mul( $a5, $b2, 22 ) + self::mul( $a6, $b1, 22 ) + self::mul( $a7, $b0, 22 );
2989
+        $s8 = self::mul( $a0, $b8, 22 ) + self::mul( $a1, $b7, 22 ) + self::mul( $a2, $b6, 22 ) + self::mul( $a3, $b5, 22 ) +
2990
+            self::mul( $a4, $b4, 22 ) + self::mul( $a5, $b3, 22 ) + self::mul( $a6, $b2, 22 ) + self::mul( $a7, $b1, 22 ) +
2991
+            self::mul( $a8, $b0, 22 );
2992
+        $s9 = self::mul( $a0, $b9, 22 ) + self::mul( $a1, $b8, 22 ) + self::mul( $a2, $b7, 22 ) + self::mul( $a3, $b6, 22 ) +
2993
+            self::mul( $a4, $b5, 22 ) + self::mul( $a5, $b4, 22 ) + self::mul( $a6, $b3, 22 ) + self::mul( $a7, $b2, 22 ) +
2994
+            self::mul( $a8, $b1, 22 ) + self::mul( $a9, $b0, 22 );
2995
+        $s10 = self::mul( $a0, $b10, 22 ) + self::mul( $a1, $b9, 22 ) + self::mul( $a2, $b8, 22 ) + self::mul( $a3, $b7, 22 ) +
2996
+            self::mul( $a4, $b6, 22 ) + self::mul( $a5, $b5, 22 ) + self::mul( $a6, $b4, 22 ) + self::mul( $a7, $b3, 22 ) +
2997
+            self::mul( $a8, $b2, 22 ) + self::mul( $a9, $b1, 22 ) + self::mul( $a10, $b0, 22 );
2998
+        $s11 = self::mul( $a0, $b11, 22 ) + self::mul( $a1, $b10, 22 ) + self::mul( $a2, $b9, 22 ) + self::mul( $a3, $b8, 22 ) +
2999
+            self::mul( $a4, $b7, 22 ) + self::mul( $a5, $b6, 22 ) + self::mul( $a6, $b5, 22 ) + self::mul( $a7, $b4, 22 ) +
3000
+            self::mul( $a8, $b3, 22 ) + self::mul( $a9, $b2, 22 ) + self::mul( $a10, $b1, 22 ) + self::mul( $a11, $b0, 22 );
3001
+        $s12 = self::mul( $a1, $b11, 22 ) + self::mul( $a2, $b10, 22 ) + self::mul( $a3, $b9, 22 ) + self::mul( $a4, $b8, 22 ) +
3002
+            self::mul( $a5, $b7, 22 ) + self::mul( $a6, $b6, 22 ) + self::mul( $a7, $b5, 22 ) + self::mul( $a8, $b4, 22 ) +
3003
+            self::mul( $a9, $b3, 22 ) + self::mul( $a10, $b2, 22 ) + self::mul( $a11, $b1, 22 );
3004
+        $s13 = self::mul( $a2, $b11, 22 ) + self::mul( $a3, $b10, 22 ) + self::mul( $a4, $b9, 22 ) + self::mul( $a5, $b8, 22 ) +
3005
+            self::mul( $a6, $b7, 22 ) + self::mul( $a7, $b6, 22 ) + self::mul( $a8, $b5, 22 ) + self::mul( $a9, $b4, 22 ) +
3006
+            self::mul( $a10, $b3, 22 ) + self::mul( $a11, $b2, 22 );
3007
+        $s14 = self::mul( $a3, $b11, 22 ) + self::mul( $a4, $b10, 22 ) + self::mul( $a5, $b9, 22 ) + self::mul( $a6, $b8, 22 ) +
3008
+            self::mul( $a7, $b7, 22 ) + self::mul( $a8, $b6, 22 ) + self::mul( $a9, $b5, 22 ) + self::mul( $a10, $b4, 22 ) +
3009
+            self::mul( $a11, $b3, 22 );
3010
+        $s15 = self::mul( $a4, $b11, 22 ) + self::mul( $a5, $b10, 22 ) + self::mul( $a6, $b9, 22 ) + self::mul( $a7, $b8, 22 ) +
3011
+            self::mul( $a8, $b7, 22 ) + self::mul( $a9, $b6, 22 ) + self::mul( $a10, $b5, 22 ) + self::mul( $a11, $b4, 22 );
3012 3012
         $s16 =
3013
-            self::mul($a5, $b11, 22) + self::mul($a6, $b10, 22) + self::mul($a7, $b9, 22) + self::mul($a8, $b8, 22) +
3014
-            self::mul($a9, $b7, 22) + self::mul($a10, $b6, 22) + self::mul($a11, $b5, 22);
3015
-        $s17 = self::mul($a6, $b11, 22) + self::mul($a7, $b10, 22) + self::mul($a8, $b9, 22) + self::mul($a9, $b8, 22) +
3016
-            self::mul($a10, $b7, 22) + self::mul($a11, $b6, 22);
3017
-        $s18 = self::mul($a7, $b11, 22) + self::mul($a8, $b10, 22) + self::mul($a9, $b9, 22) + self::mul($a10, $b8, 22)
3018
-            + self::mul($a11, $b7, 22);
3019
-        $s19 = self::mul($a8, $b11, 22) + self::mul($a9, $b10, 22) + self::mul($a10, $b9, 22) +
3020
-            self::mul($a11, $b8, 22);
3021
-        $s20 = self::mul($a9, $b11, 22) + self::mul($a10, $b10, 22) + self::mul($a11, $b9, 22);
3022
-        $s21 = self::mul($a10, $b11, 22) + self::mul($a11, $b10, 22);
3023
-        $s22 = self::mul($a11, $b11, 22);
3013
+            self::mul( $a5, $b11, 22 ) + self::mul( $a6, $b10, 22 ) + self::mul( $a7, $b9, 22 ) + self::mul( $a8, $b8, 22 ) +
3014
+            self::mul( $a9, $b7, 22 ) + self::mul( $a10, $b6, 22 ) + self::mul( $a11, $b5, 22 );
3015
+        $s17 = self::mul( $a6, $b11, 22 ) + self::mul( $a7, $b10, 22 ) + self::mul( $a8, $b9, 22 ) + self::mul( $a9, $b8, 22 ) +
3016
+            self::mul( $a10, $b7, 22 ) + self::mul( $a11, $b6, 22 );
3017
+        $s18 = self::mul( $a7, $b11, 22 ) + self::mul( $a8, $b10, 22 ) + self::mul( $a9, $b9, 22 ) + self::mul( $a10, $b8, 22 )
3018
+            + self::mul( $a11, $b7, 22 );
3019
+        $s19 = self::mul( $a8, $b11, 22 ) + self::mul( $a9, $b10, 22 ) + self::mul( $a10, $b9, 22 ) +
3020
+            self::mul( $a11, $b8, 22 );
3021
+        $s20 = self::mul( $a9, $b11, 22 ) + self::mul( $a10, $b10, 22 ) + self::mul( $a11, $b9, 22 );
3022
+        $s21 = self::mul( $a10, $b11, 22 ) + self::mul( $a11, $b10, 22 );
3023
+        $s22 = self::mul( $a11, $b11, 22 );
3024 3024
         $s23 = 0;
3025 3025
 
3026 3026
         //    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
3027 3027
         //    s1 += carry0;
3028 3028
         //    s0 -= carry0 * ((uint64_t) 1L << 21);
3029
-        $carry0 = ($s0 + (1 << 20)) >> 21;
3029
+        $carry0 = ( $s0 + ( 1 << 20 ) ) >> 21;
3030 3030
         $s1 += $carry0;
3031 3031
         $s0 -= $carry0 << 21;
3032 3032
         //    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
3033 3033
         //    s3 += carry2;
3034 3034
         //    s2 -= carry2 * ((uint64_t) 1L << 21);
3035
-        $carry2 = ($s2 + (1 << 20)) >> 21;
3035
+        $carry2 = ( $s2 + ( 1 << 20 ) ) >> 21;
3036 3036
         $s3 += $carry2;
3037 3037
         $s2 -= $carry2 << 21;
3038 3038
         //    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
3039 3039
         //    s5 += carry4;
3040 3040
         //    s4 -= carry4 * ((uint64_t) 1L << 21);
3041
-        $carry4 = ($s4 + (1 << 20)) >> 21;
3041
+        $carry4 = ( $s4 + ( 1 << 20 ) ) >> 21;
3042 3042
         $s5 += $carry4;
3043 3043
         $s4 -= $carry4 << 21;
3044 3044
         //    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
3045 3045
         //    s7 += carry6;
3046 3046
         //    s6 -= carry6 * ((uint64_t) 1L << 21);
3047
-        $carry6 = ($s6 + (1 << 20)) >> 21;
3047
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
3048 3048
         $s7 += $carry6;
3049 3049
         $s6 -= $carry6 << 21;
3050 3050
         //    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
3051 3051
         //    s9 += carry8;
3052 3052
         //    s8 -= carry8 * ((uint64_t) 1L << 21);
3053
-        $carry8 = ($s8 + (1 << 20)) >> 21;
3053
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
3054 3054
         $s9 += $carry8;
3055 3055
         $s8 -= $carry8 << 21;
3056 3056
         //    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
3057 3057
         //    s11 += carry10;
3058 3058
         //    s10 -= carry10 * ((uint64_t) 1L << 21);
3059
-        $carry10 = ($s10 + (1 << 20)) >> 21;
3059
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
3060 3060
         $s11 += $carry10;
3061 3061
         $s10 -= $carry10 << 21;
3062 3062
         //    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
3063 3063
         //    s13 += carry12;
3064 3064
         //    s12 -= carry12 * ((uint64_t) 1L << 21);
3065
-        $carry12 = ($s12 + (1 << 20)) >> 21;
3065
+        $carry12 = ( $s12 + ( 1 << 20 ) ) >> 21;
3066 3066
         $s13 += $carry12;
3067 3067
         $s12 -= $carry12 << 21;
3068 3068
         //    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
3069 3069
         //    s15 += carry14;
3070 3070
         //    s14 -= carry14 * ((uint64_t) 1L << 21);
3071
-        $carry14 = ($s14 + (1 << 20)) >> 21;
3071
+        $carry14 = ( $s14 + ( 1 << 20 ) ) >> 21;
3072 3072
         $s15 += $carry14;
3073 3073
         $s14 -= $carry14 << 21;
3074 3074
         //    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
3075 3075
         //    s17 += carry16;
3076 3076
         //    s16 -= carry16 * ((uint64_t) 1L << 21);
3077
-        $carry16 = ($s16 + (1 << 20)) >> 21;
3077
+        $carry16 = ( $s16 + ( 1 << 20 ) ) >> 21;
3078 3078
         $s17 += $carry16;
3079 3079
         $s16 -= $carry16 << 21;
3080 3080
         //    carry18 = (s18 + (int64_t) (1L << 20)) >> 21;
3081 3081
         //    s19 += carry18;
3082 3082
         //    s18 -= carry18 * ((uint64_t) 1L << 21);
3083
-        $carry18 = ($s18 + (1 << 20)) >> 21;
3083
+        $carry18 = ( $s18 + ( 1 << 20 ) ) >> 21;
3084 3084
         $s19 += $carry18;
3085 3085
         $s18 -= $carry18 << 21;
3086 3086
         //    carry20 = (s20 + (int64_t) (1L << 20)) >> 21;
3087 3087
         //    s21 += carry20;
3088 3088
         //    s20 -= carry20 * ((uint64_t) 1L << 21);
3089
-        $carry20 = ($s20 + (1 << 20)) >> 21;
3089
+        $carry20 = ( $s20 + ( 1 << 20 ) ) >> 21;
3090 3090
         $s21 += $carry20;
3091 3091
         $s20 -= $carry20 << 21;
3092 3092
         //    carry22 = (s22 + (int64_t) (1L << 20)) >> 21;
3093 3093
         //    s23 += carry22;
3094 3094
         //    s22 -= carry22 * ((uint64_t) 1L << 21);
3095
-        $carry22 = ($s22 + (1 << 20)) >> 21;
3095
+        $carry22 = ( $s22 + ( 1 << 20 ) ) >> 21;
3096 3096
         $s23 += $carry22;
3097 3097
         $s22 -= $carry22 << 21;
3098 3098
 
3099 3099
         //    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
3100 3100
         //    s2 += carry1;
3101 3101
         //    s1 -= carry1 * ((uint64_t) 1L << 21);
3102
-        $carry1 = ($s1 + (1 << 20)) >> 21;
3102
+        $carry1 = ( $s1 + ( 1 << 20 ) ) >> 21;
3103 3103
         $s2 += $carry1;
3104 3104
         $s1 -= $carry1 << 21;
3105 3105
         //    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
3106 3106
         //    s4 += carry3;
3107 3107
         //    s3 -= carry3 * ((uint64_t) 1L << 21);
3108
-        $carry3 = ($s3 + (1 << 20)) >> 21;
3108
+        $carry3 = ( $s3 + ( 1 << 20 ) ) >> 21;
3109 3109
         $s4 += $carry3;
3110 3110
         $s3 -= $carry3 << 21;
3111 3111
         //    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
3112 3112
         //    s6 += carry5;
3113 3113
         //    s5 -= carry5 * ((uint64_t) 1L << 21);
3114
-        $carry5 = ($s5 + (1 << 20)) >> 21;
3114
+        $carry5 = ( $s5 + ( 1 << 20 ) ) >> 21;
3115 3115
         $s6 += $carry5;
3116 3116
         $s5 -= $carry5 << 21;
3117 3117
         //    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
3118 3118
         //    s8 += carry7;
3119 3119
         //    s7 -= carry7 * ((uint64_t) 1L << 21);
3120
-        $carry7 = ($s7 + (1 << 20)) >> 21;
3120
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
3121 3121
         $s8 += $carry7;
3122 3122
         $s7 -= $carry7 << 21;
3123 3123
         //    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
3124 3124
         //    s10 += carry9;
3125 3125
         //    s9 -= carry9 * ((uint64_t) 1L << 21);
3126
-        $carry9 = ($s9 + (1 << 20)) >> 21;
3126
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
3127 3127
         $s10 += $carry9;
3128 3128
         $s9 -= $carry9 << 21;
3129 3129
         //    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
3130 3130
         //    s12 += carry11;
3131 3131
         //    s11 -= carry11 * ((uint64_t) 1L << 21);
3132
-        $carry11 = ($s11 + (1 << 20)) >> 21;
3132
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
3133 3133
         $s12 += $carry11;
3134 3134
         $s11 -= $carry11 << 21;
3135 3135
         //    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
3136 3136
         //    s14 += carry13;
3137 3137
         //    s13 -= carry13 * ((uint64_t) 1L << 21);
3138
-        $carry13 = ($s13 + (1 << 20)) >> 21;
3138
+        $carry13 = ( $s13 + ( 1 << 20 ) ) >> 21;
3139 3139
         $s14 += $carry13;
3140 3140
         $s13 -= $carry13 << 21;
3141 3141
         //    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
3142 3142
         //    s16 += carry15;
3143 3143
         //    s15 -= carry15 * ((uint64_t) 1L << 21);
3144
-        $carry15 = ($s15 + (1 << 20)) >> 21;
3144
+        $carry15 = ( $s15 + ( 1 << 20 ) ) >> 21;
3145 3145
         $s16 += $carry15;
3146 3146
         $s15 -= $carry15 << 21;
3147 3147
         //    carry17 = (s17 + (int64_t) (1L << 20)) >> 21;
3148 3148
         //    s18 += carry17;
3149 3149
         //    s17 -= carry17 * ((uint64_t) 1L << 21);
3150
-        $carry17 = ($s17 + (1 << 20)) >> 21;
3150
+        $carry17 = ( $s17 + ( 1 << 20 ) ) >> 21;
3151 3151
         $s18 += $carry17;
3152 3152
         $s17 -= $carry17 << 21;
3153 3153
         //    carry19 = (s19 + (int64_t) (1L << 20)) >> 21;
3154 3154
         //    s20 += carry19;
3155 3155
         //    s19 -= carry19 * ((uint64_t) 1L << 21);
3156
-        $carry19 = ($s19 + (1 << 20)) >> 21;
3156
+        $carry19 = ( $s19 + ( 1 << 20 ) ) >> 21;
3157 3157
         $s20 += $carry19;
3158 3158
         $s19 -= $carry19 << 21;
3159 3159
         //    carry21 = (s21 + (int64_t) (1L << 20)) >> 21;
3160 3160
         //    s22 += carry21;
3161 3161
         //    s21 -= carry21 * ((uint64_t) 1L << 21);
3162
-        $carry21 = ($s21 + (1 << 20)) >> 21;
3162
+        $carry21 = ( $s21 + ( 1 << 20 ) ) >> 21;
3163 3163
         $s22 += $carry21;
3164 3164
         $s21 -= $carry21 << 21;
3165 3165
 
@@ -3169,12 +3169,12 @@  discard block
 block discarded – undo
3169 3169
         //    s14 -= s23 * 997805;
3170 3170
         //    s15 += s23 * 136657;
3171 3171
         //    s16 -= s23 * 683901;
3172
-        $s11 += self::mul($s23, 666643, 20);
3173
-        $s12 += self::mul($s23, 470296, 19);
3174
-        $s13 += self::mul($s23, 654183, 20);
3175
-        $s14 -= self::mul($s23, 997805, 20);
3176
-        $s15 += self::mul($s23, 136657, 18);
3177
-        $s16 -= self::mul($s23, 683901, 20);
3172
+        $s11 += self::mul( $s23, 666643, 20 );
3173
+        $s12 += self::mul( $s23, 470296, 19 );
3174
+        $s13 += self::mul( $s23, 654183, 20 );
3175
+        $s14 -= self::mul( $s23, 997805, 20 );
3176
+        $s15 += self::mul( $s23, 136657, 18 );
3177
+        $s16 -= self::mul( $s23, 683901, 20 );
3178 3178
 
3179 3179
         //    s10 += s22 * 666643;
3180 3180
         //    s11 += s22 * 470296;
@@ -3182,12 +3182,12 @@  discard block
 block discarded – undo
3182 3182
         //    s13 -= s22 * 997805;
3183 3183
         //    s14 += s22 * 136657;
3184 3184
         //    s15 -= s22 * 683901;
3185
-        $s10 += self::mul($s22, 666643, 20);
3186
-        $s11 += self::mul($s22, 470296, 19);
3187
-        $s12 += self::mul($s22, 654183, 20);
3188
-        $s13 -= self::mul($s22, 997805, 20);
3189
-        $s14 += self::mul($s22, 136657, 18);
3190
-        $s15 -= self::mul($s22, 683901, 20);
3185
+        $s10 += self::mul( $s22, 666643, 20 );
3186
+        $s11 += self::mul( $s22, 470296, 19 );
3187
+        $s12 += self::mul( $s22, 654183, 20 );
3188
+        $s13 -= self::mul( $s22, 997805, 20 );
3189
+        $s14 += self::mul( $s22, 136657, 18 );
3190
+        $s15 -= self::mul( $s22, 683901, 20 );
3191 3191
 
3192 3192
         //    s9 += s21 * 666643;
3193 3193
         //    s10 += s21 * 470296;
@@ -3195,12 +3195,12 @@  discard block
 block discarded – undo
3195 3195
         //    s12 -= s21 * 997805;
3196 3196
         //    s13 += s21 * 136657;
3197 3197
         //    s14 -= s21 * 683901;
3198
-        $s9 += self::mul($s21, 666643, 20);
3199
-        $s10 += self::mul($s21, 470296, 19);
3200
-        $s11 += self::mul($s21, 654183, 20);
3201
-        $s12 -= self::mul($s21, 997805, 20);
3202
-        $s13 += self::mul($s21, 136657, 18);
3203
-        $s14 -= self::mul($s21, 683901, 20);
3198
+        $s9 += self::mul( $s21, 666643, 20 );
3199
+        $s10 += self::mul( $s21, 470296, 19 );
3200
+        $s11 += self::mul( $s21, 654183, 20 );
3201
+        $s12 -= self::mul( $s21, 997805, 20 );
3202
+        $s13 += self::mul( $s21, 136657, 18 );
3203
+        $s14 -= self::mul( $s21, 683901, 20 );
3204 3204
 
3205 3205
         //    s8 += s20 * 666643;
3206 3206
         //    s9 += s20 * 470296;
@@ -3208,12 +3208,12 @@  discard block
 block discarded – undo
3208 3208
         //    s11 -= s20 * 997805;
3209 3209
         //    s12 += s20 * 136657;
3210 3210
         //    s13 -= s20 * 683901;
3211
-        $s8 += self::mul($s20, 666643, 20);
3212
-        $s9 += self::mul($s20, 470296, 19);
3213
-        $s10 += self::mul($s20, 654183, 20);
3214
-        $s11 -= self::mul($s20, 997805, 20);
3215
-        $s12 += self::mul($s20, 136657, 18);
3216
-        $s13 -= self::mul($s20, 683901, 20);
3211
+        $s8 += self::mul( $s20, 666643, 20 );
3212
+        $s9 += self::mul( $s20, 470296, 19 );
3213
+        $s10 += self::mul( $s20, 654183, 20 );
3214
+        $s11 -= self::mul( $s20, 997805, 20 );
3215
+        $s12 += self::mul( $s20, 136657, 18 );
3216
+        $s13 -= self::mul( $s20, 683901, 20 );
3217 3217
 
3218 3218
         //    s7 += s19 * 666643;
3219 3219
         //    s8 += s19 * 470296;
@@ -3221,12 +3221,12 @@  discard block
 block discarded – undo
3221 3221
         //    s10 -= s19 * 997805;
3222 3222
         //    s11 += s19 * 136657;
3223 3223
         //    s12 -= s19 * 683901;
3224
-        $s7 += self::mul($s19, 666643, 20);
3225
-        $s8 += self::mul($s19, 470296, 19);
3226
-        $s9 += self::mul($s19, 654183, 20);
3227
-        $s10 -= self::mul($s19, 997805, 20);
3228
-        $s11 += self::mul($s19, 136657, 18);
3229
-        $s12 -= self::mul($s19, 683901, 20);
3224
+        $s7 += self::mul( $s19, 666643, 20 );
3225
+        $s8 += self::mul( $s19, 470296, 19 );
3226
+        $s9 += self::mul( $s19, 654183, 20 );
3227
+        $s10 -= self::mul( $s19, 997805, 20 );
3228
+        $s11 += self::mul( $s19, 136657, 18 );
3229
+        $s12 -= self::mul( $s19, 683901, 20 );
3230 3230
 
3231 3231
         //    s6 += s18 * 666643;
3232 3232
         //    s7 += s18 * 470296;
@@ -3234,78 +3234,78 @@  discard block
 block discarded – undo
3234 3234
         //    s9 -= s18 * 997805;
3235 3235
         //    s10 += s18 * 136657;
3236 3236
         //    s11 -= s18 * 683901;
3237
-        $s6 += self::mul($s18, 666643, 20);
3238
-        $s7 += self::mul($s18, 470296, 19);
3239
-        $s8 += self::mul($s18, 654183, 20);
3240
-        $s9 -= self::mul($s18, 997805, 20);
3241
-        $s10 += self::mul($s18, 136657, 18);
3242
-        $s11 -= self::mul($s18, 683901, 20);
3237
+        $s6 += self::mul( $s18, 666643, 20 );
3238
+        $s7 += self::mul( $s18, 470296, 19 );
3239
+        $s8 += self::mul( $s18, 654183, 20 );
3240
+        $s9 -= self::mul( $s18, 997805, 20 );
3241
+        $s10 += self::mul( $s18, 136657, 18 );
3242
+        $s11 -= self::mul( $s18, 683901, 20 );
3243 3243
 
3244 3244
         //    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
3245 3245
         //    s7 += carry6;
3246 3246
         //    s6 -= carry6 * ((uint64_t) 1L << 21);
3247
-        $carry6 = ($s6 + (1 << 20)) >> 21;
3247
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
3248 3248
         $s7 += $carry6;
3249 3249
         $s6 -= $carry6 << 21;
3250 3250
         //    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
3251 3251
         //    s9 += carry8;
3252 3252
         //    s8 -= carry8 * ((uint64_t) 1L << 21);
3253
-        $carry8 = ($s8 + (1 << 20)) >> 21;
3253
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
3254 3254
         $s9 += $carry8;
3255 3255
         $s8 -= $carry8 << 21;
3256 3256
         //    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
3257 3257
         //    s11 += carry10;
3258 3258
         //    s10 -= carry10 * ((uint64_t) 1L << 21);
3259
-        $carry10 = ($s10 + (1 << 20)) >> 21;
3259
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
3260 3260
         $s11 += $carry10;
3261 3261
         $s10 -= $carry10 << 21;
3262 3262
         //    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
3263 3263
         //    s13 += carry12;
3264 3264
         //    s12 -= carry12 * ((uint64_t) 1L << 21);
3265
-        $carry12 = ($s12 + (1 << 20)) >> 21;
3265
+        $carry12 = ( $s12 + ( 1 << 20 ) ) >> 21;
3266 3266
         $s13 += $carry12;
3267 3267
         $s12 -= $carry12 << 21;
3268 3268
         //    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
3269 3269
         //    s15 += carry14;
3270 3270
         //    s14 -= carry14 * ((uint64_t) 1L << 21);
3271
-        $carry14 = ($s14 + (1 << 20)) >> 21;
3271
+        $carry14 = ( $s14 + ( 1 << 20 ) ) >> 21;
3272 3272
         $s15 += $carry14;
3273 3273
         $s14 -= $carry14 << 21;
3274 3274
         //    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
3275 3275
         //    s17 += carry16;
3276 3276
         //    s16 -= carry16 * ((uint64_t) 1L << 21);
3277
-        $carry16 = ($s16 + (1 << 20)) >> 21;
3277
+        $carry16 = ( $s16 + ( 1 << 20 ) ) >> 21;
3278 3278
         $s17 += $carry16;
3279 3279
         $s16 -= $carry16 << 21;
3280 3280
 
3281 3281
         //    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
3282 3282
         //    s8 += carry7;
3283 3283
         //    s7 -= carry7 * ((uint64_t) 1L << 21);
3284
-        $carry7 = ($s7 + (1 << 20)) >> 21;
3284
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
3285 3285
         $s8 += $carry7;
3286 3286
         $s7 -= $carry7 << 21;
3287 3287
         //    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
3288 3288
         //    s10 += carry9;
3289 3289
         //    s9 -= carry9 * ((uint64_t) 1L << 21);
3290
-        $carry9 = ($s9 + (1 << 20)) >> 21;
3290
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
3291 3291
         $s10 += $carry9;
3292 3292
         $s9 -= $carry9 << 21;
3293 3293
         //    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
3294 3294
         //    s12 += carry11;
3295 3295
         //    s11 -= carry11 * ((uint64_t) 1L << 21);
3296
-        $carry11 = ($s11 + (1 << 20)) >> 21;
3296
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
3297 3297
         $s12 += $carry11;
3298 3298
         $s11 -= $carry11 << 21;
3299 3299
         //    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
3300 3300
         //    s14 += carry13;
3301 3301
         //    s13 -= carry13 * ((uint64_t) 1L << 21);
3302
-        $carry13 = ($s13 + (1 << 20)) >> 21;
3302
+        $carry13 = ( $s13 + ( 1 << 20 ) ) >> 21;
3303 3303
         $s14 += $carry13;
3304 3304
         $s13 -= $carry13 << 21;
3305 3305
         //    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
3306 3306
         //    s16 += carry15;
3307 3307
         //    s15 -= carry15 * ((uint64_t) 1L << 21);
3308
-        $carry15 = ($s15 + (1 << 20)) >> 21;
3308
+        $carry15 = ( $s15 + ( 1 << 20 ) ) >> 21;
3309 3309
         $s16 += $carry15;
3310 3310
         $s15 -= $carry15 << 21;
3311 3311
 
@@ -3315,12 +3315,12 @@  discard block
 block discarded – undo
3315 3315
         //    s8 -= s17 * 997805;
3316 3316
         //    s9 += s17 * 136657;
3317 3317
         //    s10 -= s17 * 683901;
3318
-        $s5 += self::mul($s17, 666643, 20);
3319
-        $s6 += self::mul($s17, 470296, 19);
3320
-        $s7 += self::mul($s17, 654183, 20);
3321
-        $s8 -= self::mul($s17, 997805, 20);
3322
-        $s9 += self::mul($s17, 136657, 18);
3323
-        $s10 -= self::mul($s17, 683901, 20);
3318
+        $s5 += self::mul( $s17, 666643, 20 );
3319
+        $s6 += self::mul( $s17, 470296, 19 );
3320
+        $s7 += self::mul( $s17, 654183, 20 );
3321
+        $s8 -= self::mul( $s17, 997805, 20 );
3322
+        $s9 += self::mul( $s17, 136657, 18 );
3323
+        $s10 -= self::mul( $s17, 683901, 20 );
3324 3324
 
3325 3325
         //    s4 += s16 * 666643;
3326 3326
         //    s5 += s16 * 470296;
@@ -3328,12 +3328,12 @@  discard block
 block discarded – undo
3328 3328
         //    s7 -= s16 * 997805;
3329 3329
         //    s8 += s16 * 136657;
3330 3330
         //    s9 -= s16 * 683901;
3331
-        $s4 += self::mul($s16, 666643, 20);
3332
-        $s5 += self::mul($s16, 470296, 19);
3333
-        $s6 += self::mul($s16, 654183, 20);
3334
-        $s7 -= self::mul($s16, 997805, 20);
3335
-        $s8 += self::mul($s16, 136657, 18);
3336
-        $s9 -= self::mul($s16, 683901, 20);
3331
+        $s4 += self::mul( $s16, 666643, 20 );
3332
+        $s5 += self::mul( $s16, 470296, 19 );
3333
+        $s6 += self::mul( $s16, 654183, 20 );
3334
+        $s7 -= self::mul( $s16, 997805, 20 );
3335
+        $s8 += self::mul( $s16, 136657, 18 );
3336
+        $s9 -= self::mul( $s16, 683901, 20 );
3337 3337
 
3338 3338
         //    s3 += s15 * 666643;
3339 3339
         //    s4 += s15 * 470296;
@@ -3341,12 +3341,12 @@  discard block
 block discarded – undo
3341 3341
         //    s6 -= s15 * 997805;
3342 3342
         //    s7 += s15 * 136657;
3343 3343
         //    s8 -= s15 * 683901;
3344
-        $s3 += self::mul($s15, 666643, 20);
3345
-        $s4 += self::mul($s15, 470296, 19);
3346
-        $s5 += self::mul($s15, 654183, 20);
3347
-        $s6 -= self::mul($s15, 997805, 20);
3348
-        $s7 += self::mul($s15, 136657, 18);
3349
-        $s8 -= self::mul($s15, 683901, 20);
3344
+        $s3 += self::mul( $s15, 666643, 20 );
3345
+        $s4 += self::mul( $s15, 470296, 19 );
3346
+        $s5 += self::mul( $s15, 654183, 20 );
3347
+        $s6 -= self::mul( $s15, 997805, 20 );
3348
+        $s7 += self::mul( $s15, 136657, 18 );
3349
+        $s8 -= self::mul( $s15, 683901, 20 );
3350 3350
 
3351 3351
         //    s2 += s14 * 666643;
3352 3352
         //    s3 += s14 * 470296;
@@ -3354,12 +3354,12 @@  discard block
 block discarded – undo
3354 3354
         //    s5 -= s14 * 997805;
3355 3355
         //    s6 += s14 * 136657;
3356 3356
         //    s7 -= s14 * 683901;
3357
-        $s2 += self::mul($s14, 666643, 20);
3358
-        $s3 += self::mul($s14, 470296, 19);
3359
-        $s4 += self::mul($s14, 654183, 20);
3360
-        $s5 -= self::mul($s14, 997805, 20);
3361
-        $s6 += self::mul($s14, 136657, 18);
3362
-        $s7 -= self::mul($s14, 683901, 20);
3357
+        $s2 += self::mul( $s14, 666643, 20 );
3358
+        $s3 += self::mul( $s14, 470296, 19 );
3359
+        $s4 += self::mul( $s14, 654183, 20 );
3360
+        $s5 -= self::mul( $s14, 997805, 20 );
3361
+        $s6 += self::mul( $s14, 136657, 18 );
3362
+        $s7 -= self::mul( $s14, 683901, 20 );
3363 3363
 
3364 3364
         //    s1 += s13 * 666643;
3365 3365
         //    s2 += s13 * 470296;
@@ -3367,12 +3367,12 @@  discard block
 block discarded – undo
3367 3367
         //    s4 -= s13 * 997805;
3368 3368
         //    s5 += s13 * 136657;
3369 3369
         //    s6 -= s13 * 683901;
3370
-        $s1 += self::mul($s13, 666643, 20);
3371
-        $s2 += self::mul($s13, 470296, 19);
3372
-        $s3 += self::mul($s13, 654183, 20);
3373
-        $s4 -= self::mul($s13, 997805, 20);
3374
-        $s5 += self::mul($s13, 136657, 18);
3375
-        $s6 -= self::mul($s13, 683901, 20);
3370
+        $s1 += self::mul( $s13, 666643, 20 );
3371
+        $s2 += self::mul( $s13, 470296, 19 );
3372
+        $s3 += self::mul( $s13, 654183, 20 );
3373
+        $s4 -= self::mul( $s13, 997805, 20 );
3374
+        $s5 += self::mul( $s13, 136657, 18 );
3375
+        $s6 -= self::mul( $s13, 683901, 20 );
3376 3376
 
3377 3377
         //    s0 += s12 * 666643;
3378 3378
         //    s1 += s12 * 470296;
@@ -3381,85 +3381,85 @@  discard block
 block discarded – undo
3381 3381
         //    s4 += s12 * 136657;
3382 3382
         //    s5 -= s12 * 683901;
3383 3383
         //    s12 = 0;
3384
-        $s0 += self::mul($s12, 666643, 20);
3385
-        $s1 += self::mul($s12, 470296, 19);
3386
-        $s2 += self::mul($s12, 654183, 20);
3387
-        $s3 -= self::mul($s12, 997805, 20);
3388
-        $s4 += self::mul($s12, 136657, 18);
3389
-        $s5 -= self::mul($s12, 683901, 20);
3384
+        $s0 += self::mul( $s12, 666643, 20 );
3385
+        $s1 += self::mul( $s12, 470296, 19 );
3386
+        $s2 += self::mul( $s12, 654183, 20 );
3387
+        $s3 -= self::mul( $s12, 997805, 20 );
3388
+        $s4 += self::mul( $s12, 136657, 18 );
3389
+        $s5 -= self::mul( $s12, 683901, 20 );
3390 3390
         $s12 = 0;
3391 3391
 
3392 3392
         //    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
3393 3393
         //    s1 += carry0;
3394 3394
         //    s0 -= carry0 * ((uint64_t) 1L << 21);
3395
-        $carry0 = ($s0 + (1 << 20)) >> 21;
3395
+        $carry0 = ( $s0 + ( 1 << 20 ) ) >> 21;
3396 3396
         $s1 += $carry0;
3397 3397
         $s0 -= $carry0 << 21;
3398 3398
         //    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
3399 3399
         //    s3 += carry2;
3400 3400
         //    s2 -= carry2 * ((uint64_t) 1L << 21);
3401
-        $carry2 = ($s2 + (1 << 20)) >> 21;
3401
+        $carry2 = ( $s2 + ( 1 << 20 ) ) >> 21;
3402 3402
         $s3 += $carry2;
3403 3403
         $s2 -= $carry2 << 21;
3404 3404
         //    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
3405 3405
         //    s5 += carry4;
3406 3406
         //    s4 -= carry4 * ((uint64_t) 1L << 21);
3407
-        $carry4 = ($s4 + (1 << 20)) >> 21;
3407
+        $carry4 = ( $s4 + ( 1 << 20 ) ) >> 21;
3408 3408
         $s5 += $carry4;
3409 3409
         $s4 -= $carry4 << 21;
3410 3410
         //    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
3411 3411
         //    s7 += carry6;
3412 3412
         //    s6 -= carry6 * ((uint64_t) 1L << 21);
3413
-        $carry6 = ($s6 + (1 << 20)) >> 21;
3413
+        $carry6 = ( $s6 + ( 1 << 20 ) ) >> 21;
3414 3414
         $s7 += $carry6;
3415 3415
         $s6 -= $carry6 << 21;
3416 3416
         //    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
3417 3417
         //    s9 += carry8;
3418 3418
         //    s8 -= carry8 * ((uint64_t) 1L << 21);
3419
-        $carry8 = ($s8 + (1 << 20)) >> 21;
3419
+        $carry8 = ( $s8 + ( 1 << 20 ) ) >> 21;
3420 3420
         $s9 += $carry8;
3421 3421
         $s8 -= $carry8 << 21;
3422 3422
         //    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
3423 3423
         //    s11 += carry10;
3424 3424
         //    s10 -= carry10 * ((uint64_t) 1L << 21);
3425
-        $carry10 = ($s10 + (1 << 20)) >> 21;
3425
+        $carry10 = ( $s10 + ( 1 << 20 ) ) >> 21;
3426 3426
         $s11 += $carry10;
3427 3427
         $s10 -= $carry10 << 21;
3428 3428
 
3429 3429
         //    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
3430 3430
         //    s2 += carry1;
3431 3431
         //    s1 -= carry1 * ((uint64_t) 1L << 21);
3432
-        $carry1 = ($s1 + (1 << 20)) >> 21;
3432
+        $carry1 = ( $s1 + ( 1 << 20 ) ) >> 21;
3433 3433
         $s2 += $carry1;
3434 3434
         $s1 -= $carry1 << 21;
3435 3435
         //    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
3436 3436
         //    s4 += carry3;
3437 3437
         //    s3 -= carry3 * ((uint64_t) 1L << 21);
3438
-        $carry3 = ($s3 + (1 << 20)) >> 21;
3438
+        $carry3 = ( $s3 + ( 1 << 20 ) ) >> 21;
3439 3439
         $s4 += $carry3;
3440 3440
         $s3 -= $carry3 << 21;
3441 3441
         //    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
3442 3442
         //    s6 += carry5;
3443 3443
         //    s5 -= carry5 * ((uint64_t) 1L << 21);
3444
-        $carry5 = ($s5 + (1 << 20)) >> 21;
3444
+        $carry5 = ( $s5 + ( 1 << 20 ) ) >> 21;
3445 3445
         $s6 += $carry5;
3446 3446
         $s5 -= $carry5 << 21;
3447 3447
         //    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
3448 3448
         //    s8 += carry7;
3449 3449
         //    s7 -= carry7 * ((uint64_t) 1L << 21);
3450
-        $carry7 = ($s7 + (1 << 20)) >> 21;
3450
+        $carry7 = ( $s7 + ( 1 << 20 ) ) >> 21;
3451 3451
         $s8 += $carry7;
3452 3452
         $s7 -= $carry7 << 21;
3453 3453
         //    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
3454 3454
         //    s10 += carry9;
3455 3455
         //    s9 -= carry9 * ((uint64_t) 1L << 21);
3456
-        $carry9 = ($s9 + (1 << 20)) >> 21;
3456
+        $carry9 = ( $s9 + ( 1 << 20 ) ) >> 21;
3457 3457
         $s10 += $carry9;
3458 3458
         $s9 -= $carry9 << 21;
3459 3459
         //    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
3460 3460
         //    s12 += carry11;
3461 3461
         //    s11 -= carry11 * ((uint64_t) 1L << 21);
3462
-        $carry11 = ($s11 + (1 << 20)) >> 21;
3462
+        $carry11 = ( $s11 + ( 1 << 20 ) ) >> 21;
3463 3463
         $s12 += $carry11;
3464 3464
         $s11 -= $carry11 << 21;
3465 3465
 
@@ -3470,12 +3470,12 @@  discard block
 block discarded – undo
3470 3470
         //    s4 += s12 * 136657;
3471 3471
         //    s5 -= s12 * 683901;
3472 3472
         //    s12 = 0;
3473
-        $s0 += self::mul($s12, 666643, 20);
3474
-        $s1 += self::mul($s12, 470296, 19);
3475
-        $s2 += self::mul($s12, 654183, 20);
3476
-        $s3 -= self::mul($s12, 997805, 20);
3477
-        $s4 += self::mul($s12, 136657, 18);
3478
-        $s5 -= self::mul($s12, 683901, 20);
3473
+        $s0 += self::mul( $s12, 666643, 20 );
3474
+        $s1 += self::mul( $s12, 470296, 19 );
3475
+        $s2 += self::mul( $s12, 654183, 20 );
3476
+        $s3 -= self::mul( $s12, 997805, 20 );
3477
+        $s4 += self::mul( $s12, 136657, 18 );
3478
+        $s5 -= self::mul( $s12, 683901, 20 );
3479 3479
         $s12 = 0;
3480 3480
 
3481 3481
         //    carry0 = s0 >> 21;
@@ -3557,12 +3557,12 @@  discard block
 block discarded – undo
3557 3557
         //    s3 -= s12 * 997805;
3558 3558
         //    s4 += s12 * 136657;
3559 3559
         //    s5 -= s12 * 683901;
3560
-        $s0 += self::mul($s12, 666643, 20);
3561
-        $s1 += self::mul($s12, 470296, 19);
3562
-        $s2 += self::mul($s12, 654183, 20);
3563
-        $s3 -= self::mul($s12, 997805, 20);
3564
-        $s4 += self::mul($s12, 136657, 18);
3565
-        $s5 -= self::mul($s12, 683901, 20);
3560
+        $s0 += self::mul( $s12, 666643, 20 );
3561
+        $s1 += self::mul( $s12, 470296, 19 );
3562
+        $s2 += self::mul( $s12, 654183, 20 );
3563
+        $s3 -= self::mul( $s12, 997805, 20 );
3564
+        $s4 += self::mul( $s12, 136657, 18 );
3565
+        $s5 -= self::mul( $s12, 683901, 20 );
3566 3566
 
3567 3567
         //    carry0 = s0 >> 21;
3568 3568
         //    s1 += carry0;
@@ -3631,81 +3631,81 @@  discard block
 block discarded – undo
3631 3631
         $s11 += $carry10;
3632 3632
         $s10 -= $carry10 << 21;
3633 3633
 
3634
-        $s = array_fill(0, 32, 0);
3634
+        $s = array_fill( 0, 32, 0 );
3635 3635
         // s[0]  = s0 >> 0;
3636
-        $s[0]  = $s0 >> 0;
3636
+        $s[ 0 ]  = $s0 >> 0;
3637 3637
         // s[1]  = s0 >> 8;
3638
-        $s[1]  = $s0 >> 8;
3638
+        $s[ 1 ]  = $s0 >> 8;
3639 3639
         // s[2]  = (s0 >> 16) | (s1 * ((uint64_t) 1 << 5));
3640
-        $s[2]  = ($s0 >> 16) | ($s1 << 5);
3640
+        $s[ 2 ]  = ( $s0 >> 16 ) | ( $s1 << 5 );
3641 3641
         // s[3]  = s1 >> 3;
3642
-        $s[3]  = $s1 >> 3;
3642
+        $s[ 3 ]  = $s1 >> 3;
3643 3643
         // s[4]  = s1 >> 11;
3644
-        $s[4]  = $s1 >> 11;
3644
+        $s[ 4 ]  = $s1 >> 11;
3645 3645
         // s[5]  = (s1 >> 19) | (s2 * ((uint64_t) 1 << 2));
3646
-        $s[5]  = ($s1 >> 19) | ($s2 << 2);
3646
+        $s[ 5 ]  = ( $s1 >> 19 ) | ( $s2 << 2 );
3647 3647
         // s[6]  = s2 >> 6;
3648
-        $s[6]  = $s2 >> 6;
3648
+        $s[ 6 ]  = $s2 >> 6;
3649 3649
         // s[7]  = (s2 >> 14) | (s3 * ((uint64_t) 1 << 7));
3650
-        $s[7]  = ($s2 >> 14) | ($s3 << 7);
3650
+        $s[ 7 ]  = ( $s2 >> 14 ) | ( $s3 << 7 );
3651 3651
         // s[8]  = s3 >> 1;
3652
-        $s[8]  = $s3 >> 1;
3652
+        $s[ 8 ]  = $s3 >> 1;
3653 3653
         // s[9]  = s3 >> 9;
3654
-        $s[9]  = $s3 >> 9;
3654
+        $s[ 9 ]  = $s3 >> 9;
3655 3655
         // s[10] = (s3 >> 17) | (s4 * ((uint64_t) 1 << 4));
3656
-        $s[10] = ($s3 >> 17) | ($s4 << 4);
3656
+        $s[ 10 ] = ( $s3 >> 17 ) | ( $s4 << 4 );
3657 3657
         // s[11] = s4 >> 4;
3658
-        $s[11] = $s4 >> 4;
3658
+        $s[ 11 ] = $s4 >> 4;
3659 3659
         // s[12] = s4 >> 12;
3660
-        $s[12] = $s4 >> 12;
3660
+        $s[ 12 ] = $s4 >> 12;
3661 3661
         // s[13] = (s4 >> 20) | (s5 * ((uint64_t) 1 << 1));
3662
-        $s[13] = ($s4 >> 20) | ($s5 << 1);
3662
+        $s[ 13 ] = ( $s4 >> 20 ) | ( $s5 << 1 );
3663 3663
         // s[14] = s5 >> 7;
3664
-        $s[14] = $s5 >> 7;
3664
+        $s[ 14 ] = $s5 >> 7;
3665 3665
         // s[15] = (s5 >> 15) | (s6 * ((uint64_t) 1 << 6));
3666
-        $s[15] = ($s5 >> 15) | ($s6 << 6);
3666
+        $s[ 15 ] = ( $s5 >> 15 ) | ( $s6 << 6 );
3667 3667
         // s[16] = s6 >> 2;
3668
-        $s[16] = $s6 >> 2;
3668
+        $s[ 16 ] = $s6 >> 2;
3669 3669
         // s[17] = s6 >> 10;
3670
-        $s[17] = $s6 >> 10;
3670
+        $s[ 17 ] = $s6 >> 10;
3671 3671
         // s[18] = (s6 >> 18) | (s7 * ((uint64_t) 1 << 3));
3672
-        $s[18] = ($s6 >> 18) | ($s7 << 3);
3672
+        $s[ 18 ] = ( $s6 >> 18 ) | ( $s7 << 3 );
3673 3673
         // s[19] = s7 >> 5;
3674
-        $s[19] = $s7 >> 5;
3674
+        $s[ 19 ] = $s7 >> 5;
3675 3675
         // s[20] = s7 >> 13;
3676
-        $s[20] = $s7 >> 13;
3676
+        $s[ 20 ] = $s7 >> 13;
3677 3677
         // s[21] = s8 >> 0;
3678
-        $s[21] = $s8 >> 0;
3678
+        $s[ 21 ] = $s8 >> 0;
3679 3679
         // s[22] = s8 >> 8;
3680
-        $s[22] = $s8 >> 8;
3680
+        $s[ 22 ] = $s8 >> 8;
3681 3681
         // s[23] = (s8 >> 16) | (s9 * ((uint64_t) 1 << 5));
3682
-        $s[23] = ($s8 >> 16) | ($s9 << 5);
3682
+        $s[ 23 ] = ( $s8 >> 16 ) | ( $s9 << 5 );
3683 3683
         // s[24] = s9 >> 3;
3684
-        $s[24] = $s9 >> 3;
3684
+        $s[ 24 ] = $s9 >> 3;
3685 3685
         // s[25] = s9 >> 11;
3686
-        $s[25] = $s9 >> 11;
3686
+        $s[ 25 ] = $s9 >> 11;
3687 3687
         // s[26] = (s9 >> 19) | (s10 * ((uint64_t) 1 << 2));
3688
-        $s[26] = ($s9 >> 19) | ($s10 << 2);
3688
+        $s[ 26 ] = ( $s9 >> 19 ) | ( $s10 << 2 );
3689 3689
         // s[27] = s10 >> 6;
3690
-        $s[27] = $s10 >> 6;
3690
+        $s[ 27 ] = $s10 >> 6;
3691 3691
         // s[28] = (s10 >> 14) | (s11 * ((uint64_t) 1 << 7));
3692
-        $s[28] = ($s10 >> 14) | ($s11 << 7);
3692
+        $s[ 28 ] = ( $s10 >> 14 ) | ( $s11 << 7 );
3693 3693
         // s[29] = s11 >> 1;
3694
-        $s[29] = $s11 >> 1;
3694
+        $s[ 29 ] = $s11 >> 1;
3695 3695
         // s[30] = s11 >> 9;
3696
-        $s[30] = $s11 >> 9;
3696
+        $s[ 30 ] = $s11 >> 9;
3697 3697
         // s[31] = s11 >> 17;
3698
-        $s[31] = $s11 >> 17;
3699
-        return self::intArrayToString($s);
3698
+        $s[ 31 ] = $s11 >> 17;
3699
+        return self::intArrayToString( $s );
3700 3700
     }
3701 3701
 
3702 3702
     /**
3703 3703
      * @param string $s
3704 3704
      * @return string
3705 3705
      */
3706
-    public static function sc25519_sq($s)
3706
+    public static function sc25519_sq( $s )
3707 3707
     {
3708
-        return self::sc25519_mul($s, $s);
3708
+        return self::sc25519_mul( $s, $s );
3709 3709
     }
3710 3710
 
3711 3711
     /**
@@ -3714,72 +3714,72 @@  discard block
 block discarded – undo
3714 3714
      * @param string $a
3715 3715
      * @return string
3716 3716
      */
3717
-    public static function sc25519_sqmul($s, $n, $a)
3717
+    public static function sc25519_sqmul( $s, $n, $a )
3718 3718
     {
3719
-        for ($i = 0; $i < $n; ++$i) {
3720
-            $s = self::sc25519_sq($s);
3719
+        for ( $i = 0; $i < $n; ++$i ) {
3720
+            $s = self::sc25519_sq( $s );
3721 3721
         }
3722
-        return self::sc25519_mul($s, $a);
3722
+        return self::sc25519_mul( $s, $a );
3723 3723
     }
3724 3724
 
3725 3725
     /**
3726 3726
      * @param string $s
3727 3727
      * @return string
3728 3728
      */
3729
-    public static function sc25519_invert($s)
3729
+    public static function sc25519_invert( $s )
3730 3730
     {
3731
-        $_10 = self::sc25519_sq($s);
3732
-        $_11 = self::sc25519_mul($s, $_10);
3733
-        $_100 = self::sc25519_mul($s, $_11);
3734
-        $_1000 = self::sc25519_sq($_100);
3735
-        $_1010 = self::sc25519_mul($_10, $_1000);
3736
-        $_1011 = self::sc25519_mul($s, $_1010);
3737
-        $_10000 = self::sc25519_sq($_1000);
3738
-        $_10110 = self::sc25519_sq($_1011);
3739
-        $_100000 = self::sc25519_mul($_1010, $_10110);
3740
-        $_100110 = self::sc25519_mul($_10000, $_10110);
3741
-        $_1000000 = self::sc25519_sq($_100000);
3742
-        $_1010000 = self::sc25519_mul($_10000, $_1000000);
3743
-        $_1010011 = self::sc25519_mul($_11, $_1010000);
3744
-        $_1100011 = self::sc25519_mul($_10000, $_1010011);
3745
-        $_1100111 = self::sc25519_mul($_100, $_1100011);
3746
-        $_1101011 = self::sc25519_mul($_100, $_1100111);
3747
-        $_10010011 = self::sc25519_mul($_1000000, $_1010011);
3748
-        $_10010111 = self::sc25519_mul($_100, $_10010011);
3749
-        $_10111101 = self::sc25519_mul($_100110, $_10010111);
3750
-        $_11010011 = self::sc25519_mul($_10110, $_10111101);
3751
-        $_11100111 = self::sc25519_mul($_1010000, $_10010111);
3752
-        $_11101011 = self::sc25519_mul($_100, $_11100111);
3753
-        $_11110101 = self::sc25519_mul($_1010, $_11101011);
3754
-
3755
-        $recip = self::sc25519_mul($_1011, $_11110101);
3756
-        $recip = self::sc25519_sqmul($recip, 126, $_1010011);
3757
-        $recip = self::sc25519_sqmul($recip, 9, $_10);
3758
-        $recip = self::sc25519_mul($recip, $_11110101);
3759
-        $recip = self::sc25519_sqmul($recip, 7, $_1100111);
3760
-        $recip = self::sc25519_sqmul($recip, 9, $_11110101);
3761
-        $recip = self::sc25519_sqmul($recip, 11, $_10111101);
3762
-        $recip = self::sc25519_sqmul($recip, 8, $_11100111);
3763
-        $recip = self::sc25519_sqmul($recip, 9, $_1101011);
3764
-        $recip = self::sc25519_sqmul($recip, 6, $_1011);
3765
-        $recip = self::sc25519_sqmul($recip, 14, $_10010011);
3766
-        $recip = self::sc25519_sqmul($recip, 10, $_1100011);
3767
-        $recip = self::sc25519_sqmul($recip, 9, $_10010111);
3768
-        $recip = self::sc25519_sqmul($recip, 10, $_11110101);
3769
-        $recip = self::sc25519_sqmul($recip, 8, $_11010011);
3770
-        return self::sc25519_sqmul($recip, 8, $_11101011);
3731
+        $_10 = self::sc25519_sq( $s );
3732
+        $_11 = self::sc25519_mul( $s, $_10 );
3733
+        $_100 = self::sc25519_mul( $s, $_11 );
3734
+        $_1000 = self::sc25519_sq( $_100 );
3735
+        $_1010 = self::sc25519_mul( $_10, $_1000 );
3736
+        $_1011 = self::sc25519_mul( $s, $_1010 );
3737
+        $_10000 = self::sc25519_sq( $_1000 );
3738
+        $_10110 = self::sc25519_sq( $_1011 );
3739
+        $_100000 = self::sc25519_mul( $_1010, $_10110 );
3740
+        $_100110 = self::sc25519_mul( $_10000, $_10110 );
3741
+        $_1000000 = self::sc25519_sq( $_100000 );
3742
+        $_1010000 = self::sc25519_mul( $_10000, $_1000000 );
3743
+        $_1010011 = self::sc25519_mul( $_11, $_1010000 );
3744
+        $_1100011 = self::sc25519_mul( $_10000, $_1010011 );
3745
+        $_1100111 = self::sc25519_mul( $_100, $_1100011 );
3746
+        $_1101011 = self::sc25519_mul( $_100, $_1100111 );
3747
+        $_10010011 = self::sc25519_mul( $_1000000, $_1010011 );
3748
+        $_10010111 = self::sc25519_mul( $_100, $_10010011 );
3749
+        $_10111101 = self::sc25519_mul( $_100110, $_10010111 );
3750
+        $_11010011 = self::sc25519_mul( $_10110, $_10111101 );
3751
+        $_11100111 = self::sc25519_mul( $_1010000, $_10010111 );
3752
+        $_11101011 = self::sc25519_mul( $_100, $_11100111 );
3753
+        $_11110101 = self::sc25519_mul( $_1010, $_11101011 );
3754
+
3755
+        $recip = self::sc25519_mul( $_1011, $_11110101 );
3756
+        $recip = self::sc25519_sqmul( $recip, 126, $_1010011 );
3757
+        $recip = self::sc25519_sqmul( $recip, 9, $_10 );
3758
+        $recip = self::sc25519_mul( $recip, $_11110101 );
3759
+        $recip = self::sc25519_sqmul( $recip, 7, $_1100111 );
3760
+        $recip = self::sc25519_sqmul( $recip, 9, $_11110101 );
3761
+        $recip = self::sc25519_sqmul( $recip, 11, $_10111101 );
3762
+        $recip = self::sc25519_sqmul( $recip, 8, $_11100111 );
3763
+        $recip = self::sc25519_sqmul( $recip, 9, $_1101011 );
3764
+        $recip = self::sc25519_sqmul( $recip, 6, $_1011 );
3765
+        $recip = self::sc25519_sqmul( $recip, 14, $_10010011 );
3766
+        $recip = self::sc25519_sqmul( $recip, 10, $_1100011 );
3767
+        $recip = self::sc25519_sqmul( $recip, 9, $_10010111 );
3768
+        $recip = self::sc25519_sqmul( $recip, 10, $_11110101 );
3769
+        $recip = self::sc25519_sqmul( $recip, 8, $_11010011 );
3770
+        return self::sc25519_sqmul( $recip, 8, $_11101011 );
3771 3771
     }
3772 3772
 
3773 3773
     /**
3774 3774
      * @param string $s
3775 3775
      * @return string
3776 3776
      */
3777
-    public static function clamp($s)
3777
+    public static function clamp( $s )
3778 3778
     {
3779
-        $s_ = self::stringToIntArray($s);
3780
-        $s_[0] &= 248;
3781
-        $s_[31] |= 64;
3782
-        $s_[31] &= 128;
3783
-        return self::intArrayToString($s_);
3779
+        $s_ = self::stringToIntArray( $s );
3780
+        $s_[ 0 ] &= 248;
3781
+        $s_[ 31 ] |= 64;
3782
+        $s_[ 31 ] &= 128;
3783
+        return self::intArrayToString( $s_ );
3784 3784
     }
3785 3785
 }
Please login to merge, or discard this patch.