Changeset 51591
- Timestamp:
- 08/10/2021 01:03:41 PM (3 years ago)
- Location:
- trunk/src/wp-includes/sodium_compat/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/sodium_compat/src/Compat.php
r51002 r51591 3014 3014 * DANGER! UNAUTHENTICATED ENCRYPTION! 3015 3015 * 3016 * Unless you are following expert advice, do not use dthis feature.3016 * Unless you are following expert advice, do not use this feature. 3017 3017 * 3018 3018 * Algorithm: XSalsa20 … … 3113 3113 * DANGER! UNAUTHENTICATED ENCRYPTION! 3114 3114 * 3115 * Unless you are following expert advice, do not use dthis feature.3115 * Unless you are following expert advice, do not use this feature. 3116 3116 * 3117 3117 * Algorithm: XChaCha20 -
trunk/src/wp-includes/sodium_compat/src/Core/ChaCha20/Ctx.php
r46586 r51591 70 70 * @psalm-suppress MixedArrayOffset 71 71 */ 72 #[ReturnTypeWillChange] 72 73 public function offsetSet($offset, $value) 73 74 { … … 87 88 * @return bool 88 89 */ 90 #[ReturnTypeWillChange] 89 91 public function offsetExists($offset) 90 92 { … … 99 101 * @psalm-suppress MixedArrayOffset 100 102 */ 103 #[ReturnTypeWillChange] 101 104 public function offsetUnset($offset) 102 105 { … … 111 114 * @psalm-suppress MixedArrayOffset 112 115 */ 116 #[ReturnTypeWillChange] 113 117 public function offsetGet($offset) 114 118 { -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519.php
r51002 r51591 123 123 throw new RangeException('Expected a 32-byte string.'); 124 124 } 125 /** @var int $h0 */126 125 $h0 = self::load_4($s); 127 /** @var int $h1 */128 126 $h1 = self::load_3(self::substr($s, 4, 3)) << 6; 129 /** @var int $h2 */130 127 $h2 = self::load_3(self::substr($s, 7, 3)) << 5; 131 /** @var int $h3 */132 128 $h3 = self::load_3(self::substr($s, 10, 3)) << 3; 133 /** @var int $h4 */134 129 $h4 = self::load_3(self::substr($s, 13, 3)) << 2; 135 /** @var int $h5 */136 130 $h5 = self::load_4(self::substr($s, 16, 4)); 137 /** @var int $h6 */138 131 $h6 = self::load_3(self::substr($s, 20, 3)) << 7; 139 /** @var int $h7 */140 132 $h7 = self::load_3(self::substr($s, 23, 3)) << 5; 141 /** @var int $h8 */142 133 $h8 = self::load_3(self::substr($s, 26, 3)) << 4; 143 /** @var int $h9 */144 134 $h9 = (self::load_3(self::substr($s, 29, 3)) & 8388607) << 2; 145 135 146 /** @var int $carry9 */147 136 $carry9 = ($h9 + (1 << 24)) >> 25; 148 137 $h0 += self::mul($carry9, 19, 5); 149 138 $h9 -= $carry9 << 25; 150 /** @var int $carry1 */151 139 $carry1 = ($h1 + (1 << 24)) >> 25; 152 140 $h2 += $carry1; 153 141 $h1 -= $carry1 << 25; 154 /** @var int $carry3 */155 142 $carry3 = ($h3 + (1 << 24)) >> 25; 156 143 $h4 += $carry3; 157 144 $h3 -= $carry3 << 25; 158 /** @var int $carry5 */159 145 $carry5 = ($h5 + (1 << 24)) >> 25; 160 146 $h6 += $carry5; 161 147 $h5 -= $carry5 << 25; 162 /** @var int $carry7 */163 148 $carry7 = ($h7 + (1 << 24)) >> 25; 164 149 $h8 += $carry7; 165 150 $h7 -= $carry7 << 25; 166 151 167 /** @var int $carry0 */168 152 $carry0 = ($h0 + (1 << 25)) >> 26; 169 153 $h1 += $carry0; 170 154 $h0 -= $carry0 << 26; 171 /** @var int $carry2 */172 155 $carry2 = ($h2 + (1 << 25)) >> 26; 173 156 $h3 += $carry2; 174 157 $h2 -= $carry2 << 26; 175 /** @var int $carry4 */176 158 $carry4 = ($h4 + (1 << 25)) >> 26; 177 159 $h5 += $carry4; 178 160 $h4 -= $carry4 << 26; 179 /** @var int $carry6 */180 161 $carry6 = ($h6 + (1 << 25)) >> 26; 181 162 $h7 += $carry6; 182 163 $h6 -= $carry6 << 26; 183 /** @var int $carry8 */184 164 $carry8 = ($h8 + (1 << 25)) >> 26; 185 165 $h9 += $carry8; … … 212 192 public static function fe_tobytes(ParagonIE_Sodium_Core_Curve25519_Fe $h) 213 193 { 214 /** @var int $h0 */215 194 $h0 = (int) $h[0]; 216 /** @var int $h1 */217 195 $h1 = (int) $h[1]; 218 /** @var int $h2 */219 196 $h2 = (int) $h[2]; 220 /** @var int $h3 */221 197 $h3 = (int) $h[3]; 222 /** @var int $h4 */223 198 $h4 = (int) $h[4]; 224 /** @var int $h5 */225 199 $h5 = (int) $h[5]; 226 /** @var int $h6 */227 200 $h6 = (int) $h[6]; 228 /** @var int $h7 */229 201 $h7 = (int) $h[7]; 230 /** @var int $h8 */231 202 $h8 = (int) $h[8]; 232 /** @var int $h9 */233 203 $h9 = (int) $h[9]; 234 204 235 /** @var int $q */236 205 $q = (self::mul($h9, 19, 5) + (1 << 24)) >> 25; 237 /** @var int $q */238 206 $q = ($h0 + $q) >> 26; 239 /** @var int $q */240 207 $q = ($h1 + $q) >> 25; 241 /** @var int $q */242 208 $q = ($h2 + $q) >> 26; 243 /** @var int $q */244 209 $q = ($h3 + $q) >> 25; 245 /** @var int $q */246 210 $q = ($h4 + $q) >> 26; 247 /** @var int $q */248 211 $q = ($h5 + $q) >> 25; 249 /** @var int $q */250 212 $q = ($h6 + $q) >> 26; 251 /** @var int $q */252 213 $q = ($h7 + $q) >> 25; 253 /** @var int $q */254 214 $q = ($h8 + $q) >> 26; 255 /** @var int $q */256 215 $q = ($h9 + $q) >> 25; 257 216 258 217 $h0 += self::mul($q, 19, 5); 259 218 260 /** @var int $carry0 */261 219 $carry0 = $h0 >> 26; 262 220 $h1 += $carry0; 263 221 $h0 -= $carry0 << 26; 264 /** @var int $carry1 */265 222 $carry1 = $h1 >> 25; 266 223 $h2 += $carry1; 267 224 $h1 -= $carry1 << 25; 268 /** @var int $carry2 */269 225 $carry2 = $h2 >> 26; 270 226 $h3 += $carry2; 271 227 $h2 -= $carry2 << 26; 272 /** @var int $carry3 */273 228 $carry3 = $h3 >> 25; 274 229 $h4 += $carry3; 275 230 $h3 -= $carry3 << 25; 276 /** @var int $carry4 */277 231 $carry4 = $h4 >> 26; 278 232 $h5 += $carry4; 279 233 $h4 -= $carry4 << 26; 280 /** @var int $carry5 */281 234 $carry5 = $h5 >> 25; 282 235 $h6 += $carry5; 283 236 $h5 -= $carry5 << 25; 284 /** @var int $carry6 */285 237 $carry6 = $h6 >> 26; 286 238 $h7 += $carry6; 287 239 $h6 -= $carry6 << 26; 288 /** @var int $carry7 */289 240 $carry7 = $h7 >> 25; 290 241 $h8 += $carry7; 291 242 $h7 -= $carry7 << 25; 292 /** @var int $carry8 */293 243 $carry8 = $h8 >> 26; 294 244 $h9 += $carry8; 295 245 $h8 -= $carry8 << 26; 296 /** @var int $carry9 */297 246 $carry9 = $h9 >> 25; 298 247 $h9 -= $carry9 << 25; … … 394 343 ParagonIE_Sodium_Core_Curve25519_Fe $g 395 344 ) { 396 /** @var int $f0 */397 345 $f0 = $f[0]; 398 /** @var int $f1 */399 346 $f1 = $f[1]; 400 /** @var int $f2 */401 347 $f2 = $f[2]; 402 /** @var int $f3 */403 348 $f3 = $f[3]; 404 /** @var int $f4 */405 349 $f4 = $f[4]; 406 /** @var int $f5 */407 350 $f5 = $f[5]; 408 /** @var int $f6 */409 351 $f6 = $f[6]; 410 /** @var int $f7 */411 352 $f7 = $f[7]; 412 /** @var int $f8 */413 353 $f8 = $f[8]; 414 /** @var int $f9 */415 354 $f9 = $f[9]; 416 /** @var int $g0 */417 355 $g0 = $g[0]; 418 /** @var int $g1 */419 356 $g1 = $g[1]; 420 /** @var int $g2 */421 357 $g2 = $g[2]; 422 /** @var int $g3 */423 358 $g3 = $g[3]; 424 /** @var int $g4 */425 359 $g4 = $g[4]; 426 /** @var int $g5 */427 360 $g5 = $g[5]; 428 /** @var int $g6 */429 361 $g6 = $g[6]; 430 /** @var int $g7 */431 362 $g7 = $g[7]; 432 /** @var int $g8 */433 363 $g8 = $g[8]; 434 /** @var int $g9 */435 364 $g9 = $g[9]; 436 365 $g1_19 = self::mul($g1, 19, 5); … … 443 372 $g8_19 = self::mul($g8, 19, 5); 444 373 $g9_19 = self::mul($g9, 19, 5); 445 /** @var int $f1_2 */446 374 $f1_2 = $f1 << 1; 447 /** @var int $f3_2 */448 375 $f3_2 = $f3 << 1; 449 /** @var int $f5_2 */450 376 $f5_2 = $f5 << 1; 451 /** @var int $f7_2 */452 377 $f7_2 = $f7 << 1; 453 /** @var int $f9_2 */454 378 $f9_2 = $f9 << 1; 455 379 $f0g0 = self::mul($f0, $g0, 26); … … 564 488 $h9 = $f0g9 + $f1g8 + $f2g7 + $f3g6 + $f4g5 + $f5g4 + $f6g3 + $f7g2 + $f8g1 + $f9g0 ; 565 489 566 /** @var int $carry0 */567 490 $carry0 = ($h0 + (1 << 25)) >> 26; 568 491 $h1 += $carry0; 569 492 $h0 -= $carry0 << 26; 570 /** @var int $carry4 */571 493 $carry4 = ($h4 + (1 << 25)) >> 26; 572 494 $h5 += $carry4; 573 495 $h4 -= $carry4 << 26; 574 496 575 /** @var int $carry1 */576 497 $carry1 = ($h1 + (1 << 24)) >> 25; 577 498 $h2 += $carry1; 578 499 $h1 -= $carry1 << 25; 579 /** @var int $carry5 */580 500 $carry5 = ($h5 + (1 << 24)) >> 25; 581 501 $h6 += $carry5; 582 502 $h5 -= $carry5 << 25; 583 503 584 /** @var int $carry2 */585 504 $carry2 = ($h2 + (1 << 25)) >> 26; 586 505 $h3 += $carry2; 587 506 $h2 -= $carry2 << 26; 588 /** @var int $carry6 */589 507 $carry6 = ($h6 + (1 << 25)) >> 26; 590 508 $h7 += $carry6; 591 509 $h6 -= $carry6 << 26; 592 510 593 /** @var int $carry3 */594 511 $carry3 = ($h3 + (1 << 24)) >> 25; 595 512 $h4 += $carry3; 596 513 $h3 -= $carry3 << 25; 597 /** @var int $carry7 */598 514 $carry7 = ($h7 + (1 << 24)) >> 25; 599 515 $h8 += $carry7; 600 516 $h7 -= $carry7 << 25; 601 517 602 /** @var int $carry4 */603 518 $carry4 = ($h4 + (1 << 25)) >> 26; 604 519 $h5 += $carry4; 605 520 $h4 -= $carry4 << 26; 606 /** @var int $carry8 */607 521 $carry8 = ($h8 + (1 << 25)) >> 26; 608 522 $h9 += $carry8; 609 523 $h8 -= $carry8 << 26; 610 524 611 /** @var int $carry9 */612 525 $carry9 = ($h9 + (1 << 24)) >> 25; 613 526 $h0 += self::mul($carry9, 19, 5); 614 527 $h9 -= $carry9 << 25; 615 528 616 /** @var int $carry0 */617 529 $carry0 = ($h0 + (1 << 25)) >> 26; 618 530 $h1 += $carry0; … … 678 590 $f9 = (int) $f[9]; 679 591 680 /** @var int $f0_2 */681 592 $f0_2 = $f0 << 1; 682 /** @var int $f1_2 */683 593 $f1_2 = $f1 << 1; 684 /** @var int $f2_2 */685 594 $f2_2 = $f2 << 1; 686 /** @var int $f3_2 */687 595 $f3_2 = $f3 << 1; 688 /** @var int $f4_2 */689 596 $f4_2 = $f4 << 1; 690 /** @var int $f5_2 */691 597 $f5_2 = $f5 << 1; 692 /** @var int $f6_2 */693 598 $f6_2 = $f6 << 1; 694 /** @var int $f7_2 */695 599 $f7_2 = $f7 << 1; 696 600 $f5_38 = self::mul($f5, 38, 6); … … 699 603 $f8_19 = self::mul($f8, 19, 5); 700 604 $f9_38 = self::mul($f9, 38, 6); 701 $f0f0 = self::mul($f0, $f0, 2 5);702 $f0f1_2 = self::mul($f0_2, $f1, 2 4);605 $f0f0 = self::mul($f0, $f0, 26); 606 $f0f1_2 = self::mul($f0_2, $f1, 26); 703 607 $f0f2_2 = self::mul($f0_2, $f2, 26); 704 $f0f3_2 = self::mul($f0_2, $f3, 2 4);705 $f0f4_2 = self::mul($f0_2, $f4, 2 5);706 $f0f5_2 = self::mul($f0_2, $f5, 2 5);707 $f0f6_2 = self::mul($f0_2, $f6, 2 5);708 $f0f7_2 = self::mul($f0_2, $f7, 2 4);709 $f0f8_2 = self::mul($f0_2, $f8, 2 5);710 $f0f9_2 = self::mul($f0_2, $f9, 2 5);711 $f1f1_2 = self::mul($f1_2, $f1, 2 4);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); 712 616 $f1f2_2 = self::mul($f1_2, $f2, 26); 713 $f1f3_4 = self::mul($f1_2, $f3_2, 2 5);714 $f1f4_2 = self::mul($f1_2, $f4, 2 5);617 $f1f3_4 = self::mul($f1_2, $f3_2, 26); 618 $f1f4_2 = self::mul($f1_2, $f4, 26); 715 619 $f1f5_4 = self::mul($f1_2, $f5_2, 26); 716 $f1f6_2 = self::mul($f1_2, $f6, 2 5);717 $f1f7_4 = self::mul($f1_2, $f7_2, 2 5);718 $f1f8_2 = self::mul($f1_2, $f8, 2 5);719 $f1f9_76 = self::mul($f9_38, $f1_2, 2 5);720 $f2f2 = self::mul($f2, $f2, 2 6);721 $f2f3_2 = self::mul($f2_2, $f3, 2 4);722 $f2f4_2 = self::mul($f2_2, $f4, 2 5);723 $f2f5_2 = self::mul($f2_2, $f5, 2 5);724 $f2f6_2 = self::mul($f2_2, $f6, 2 5);725 $f2f7_2 = self::mul($f2_2, $f7, 2 5);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); 726 630 $f2f8_38 = self::mul($f8_19, $f2_2, 27); 727 631 $f2f9_38 = self::mul($f9_38, $f2, 26); 728 $f3f3_2 = self::mul($f3_2, $f3, 2 5);729 $f3f4_2 = self::mul($f3_2, $f4, 2 5);632 $f3f3_2 = self::mul($f3_2, $f3, 26); 633 $f3f4_2 = self::mul($f3_2, $f4, 26); 730 634 $f3f5_4 = self::mul($f3_2, $f5_2, 26); 731 $f3f6_2 = self::mul($f3_2, $f6, 2 5);732 $f3f7_76 = self::mul($f7_38, $f3_2, 2 5);733 $f3f8_38 = self::mul($f8_19, $f3_2, 2 5);734 $f3f9_76 = self::mul($f9_38, $f3_2, 2 5);735 $f4f4 = self::mul($f4, $f4, 2 5);736 $f4f5_2 = self::mul($f4_2, $f5, 2 5);737 $f4f6_38 = self::mul($f6_19, $f4_2, 2 6);738 $f4f7_38 = self::mul($f7_38, $f4, 2 5);739 $f4f8_38 = self::mul($f8_19, $f4_2, 2 6);740 $f4f9_38 = self::mul($f9_38, $f4, 2 5);741 $f5f5_38 = self::mul($f5_38, $f5, 2 5);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); 742 646 $f5f6_38 = self::mul($f6_19, $f5_2, 26); 743 647 $f5f7_76 = self::mul($f7_38, $f5_2, 26); 744 648 $f5f8_38 = self::mul($f8_19, $f5_2, 26); 745 649 $f5f9_76 = self::mul($f9_38, $f5_2, 26); 746 $f6f6_19 = self::mul($f6_19, $f6, 2 5);747 $f6f7_38 = self::mul($f7_38, $f6, 2 5);748 $f6f8_38 = self::mul($f8_19, $f6_2, 2 6);749 $f6f9_38 = self::mul($f9_38, $f6, 2 5);750 $f7f7_38 = self::mul($f7_38, $f7, 2 4);751 $f7f8_38 = self::mul($f8_19, $f7_2, 2 5);752 $f7f9_76 = self::mul($f9_38, $f7_2, 2 5);753 $f8f8_19 = self::mul($f8_19, $f8, 2 5);754 $f8f9_38 = self::mul($f9_38, $f8, 2 5);755 $f9f9_38 = self::mul($f9_38, $f9, 2 5);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); 756 660 $h0 = $f0f0 + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38; 757 661 $h1 = $f0f1_2 + $f2f9_38 + $f3f8_38 + $f4f7_38 + $f5f6_38; … … 765 669 $h9 = $f0f9_2 + $f1f8_2 + $f2f7_2 + $f3f6_2 + $f4f5_2; 766 670 767 /** @var int $carry0 */768 671 $carry0 = ($h0 + (1 << 25)) >> 26; 769 672 $h1 += $carry0; 770 673 $h0 -= $carry0 << 26; 771 /** @var int $carry4 */772 674 $carry4 = ($h4 + (1 << 25)) >> 26; 773 675 $h5 += $carry4; 774 676 $h4 -= $carry4 << 26; 775 677 776 /** @var int $carry1 */777 678 $carry1 = ($h1 + (1 << 24)) >> 25; 778 679 $h2 += $carry1; 779 680 $h1 -= $carry1 << 25; 780 /** @var int $carry5 */781 681 $carry5 = ($h5 + (1 << 24)) >> 25; 782 682 $h6 += $carry5; 783 683 $h5 -= $carry5 << 25; 784 684 785 /** @var int $carry2 */786 685 $carry2 = ($h2 + (1 << 25)) >> 26; 787 686 $h3 += $carry2; 788 687 $h2 -= $carry2 << 26; 789 /** @var int $carry6 */790 688 $carry6 = ($h6 + (1 << 25)) >> 26; 791 689 $h7 += $carry6; 792 690 $h6 -= $carry6 << 26; 793 691 794 /** @var int $carry3 */795 692 $carry3 = ($h3 + (1 << 24)) >> 25; 796 693 $h4 += $carry3; 797 694 $h3 -= $carry3 << 25; 798 /** @var int $carry7 */799 695 $carry7 = ($h7 + (1 << 24)) >> 25; 800 696 $h8 += $carry7; 801 697 $h7 -= $carry7 << 25; 802 698 803 /** @var int $carry4 */804 699 $carry4 = ($h4 + (1 << 25)) >> 26; 805 700 $h5 += $carry4; 806 701 $h4 -= $carry4 << 26; 807 /** @var int $carry8 */808 702 $carry8 = ($h8 + (1 << 25)) >> 26; 809 703 $h9 += $carry8; 810 704 $h8 -= $carry8 << 26; 811 705 812 /** @var int $carry9 */813 706 $carry9 = ($h9 + (1 << 24)) >> 25; 814 707 $h0 += self::mul($carry9, 19, 5); 815 708 $h9 -= $carry9 << 25; 816 709 817 /** @var int $carry0 */818 710 $carry0 = ($h0 + (1 << 25)) >> 26; 819 711 $h1 += $carry0; … … 860 752 $f9 = (int) $f[9]; 861 753 862 /** @var int $f0_2 */863 754 $f0_2 = $f0 << 1; 864 /** @var int $f1_2 */865 755 $f1_2 = $f1 << 1; 866 /** @var int $f2_2 */867 756 $f2_2 = $f2 << 1; 868 /** @var int $f3_2 */869 757 $f3_2 = $f3 << 1; 870 /** @var int $f4_2 */871 758 $f4_2 = $f4 << 1; 872 /** @var int $f5_2 */873 759 $f5_2 = $f5 << 1; 874 /** @var int $f6_2 */875 760 $f6_2 = $f6 << 1; 876 /** @var int $f7_2 */877 761 $f7_2 = $f7 << 1; 878 762 $f5_38 = self::mul($f5, 38, 6); /* 1.959375*2^30 */ … … 937 821 $f9f9_38 = self::mul($f9_38, $f9, 24); 938 822 939 /** @var int $h0 */940 823 $h0 = (int) ($f0f0 + $f1f9_76 + $f2f8_38 + $f3f7_76 + $f4f6_38 + $f5f5_38) << 1; 941 /** @var int $h1 */942 824 $h1 = (int) ($f0f1_2 + $f2f9_38 + $f3f8_38 + $f4f7_38 + $f5f6_38) << 1; 943 /** @var int $h2 */944 825 $h2 = (int) ($f0f2_2 + $f1f1_2 + $f3f9_76 + $f4f8_38 + $f5f7_76 + $f6f6_19) << 1; 945 /** @var int $h3 */946 826 $h3 = (int) ($f0f3_2 + $f1f2_2 + $f4f9_38 + $f5f8_38 + $f6f7_38) << 1; 947 /** @var int $h4 */948 827 $h4 = (int) ($f0f4_2 + $f1f3_4 + $f2f2 + $f5f9_76 + $f6f8_38 + $f7f7_38) << 1; 949 /** @var int $h5 */950 828 $h5 = (int) ($f0f5_2 + $f1f4_2 + $f2f3_2 + $f6f9_38 + $f7f8_38) << 1; 951 /** @var int $h6 */952 829 $h6 = (int) ($f0f6_2 + $f1f5_4 + $f2f4_2 + $f3f3_2 + $f7f9_76 + $f8f8_19) << 1; 953 /** @var int $h7 */954 830 $h7 = (int) ($f0f7_2 + $f1f6_2 + $f2f5_2 + $f3f4_2 + $f8f9_38) << 1; 955 /** @var int $h8 */956 831 $h8 = (int) ($f0f8_2 + $f1f7_4 + $f2f6_2 + $f3f5_4 + $f4f4 + $f9f9_38) << 1; 957 /** @var int $h9 */958 832 $h9 = (int) ($f0f9_2 + $f1f8_2 + $f2f7_2 + $f3f6_2 + $f4f5_2) << 1; 959 833 960 /** @var int $carry0 */961 834 $carry0 = ($h0 + (1 << 25)) >> 26; 962 835 $h1 += $carry0; 963 836 $h0 -= $carry0 << 26; 964 /** @var int $carry4 */965 837 $carry4 = ($h4 + (1 << 25)) >> 26; 966 838 $h5 += $carry4; 967 839 $h4 -= $carry4 << 26; 968 840 969 /** @var int $carry1 */970 841 $carry1 = ($h1 + (1 << 24)) >> 25; 971 842 $h2 += $carry1; 972 843 $h1 -= $carry1 << 25; 973 /** @var int $carry5 */974 844 $carry5 = ($h5 + (1 << 24)) >> 25; 975 845 $h6 += $carry5; 976 846 $h5 -= $carry5 << 25; 977 847 978 /** @var int $carry2 */979 848 $carry2 = ($h2 + (1 << 25)) >> 26; 980 849 $h3 += $carry2; 981 850 $h2 -= $carry2 << 26; 982 /** @var int $carry6 */983 851 $carry6 = ($h6 + (1 << 25)) >> 26; 984 852 $h7 += $carry6; 985 853 $h6 -= $carry6 << 26; 986 854 987 /** @var int $carry3 */988 855 $carry3 = ($h3 + (1 << 24)) >> 25; 989 856 $h4 += $carry3; 990 857 $h3 -= $carry3 << 25; 991 /** @var int $carry7 */992 858 $carry7 = ($h7 + (1 << 24)) >> 25; 993 859 $h8 += $carry7; 994 860 $h7 -= $carry7 << 25; 995 861 996 /** @var int $carry4 */997 862 $carry4 = ($h4 + (1 << 25)) >> 26; 998 863 $h5 += $carry4; 999 864 $h4 -= $carry4 << 26; 1000 /** @var int $carry8 */1001 865 $carry8 = ($h8 + (1 << 25)) >> 26; 1002 866 $h9 += $carry8; 1003 867 $h8 -= $carry8 << 26; 1004 868 1005 /** @var int $carry9 */1006 869 $carry9 = ($h9 + (1 << 24)) >> 25; 1007 870 $h0 += self::mul($carry9, 19, 5); 1008 871 $h9 -= $carry9 << 25; 1009 872 1010 /** @var int $carry0 */1011 873 $carry0 = ($h0 + (1 << 25)) >> 26; 1012 874 $h1 += $carry0; … … 1791 1653 } 1792 1654 1793 /** @var int $bnegative */1794 1655 $bnegative = self::negative($b); 1795 /** @var int $babs */1796 1656 $babs = $b - (((-$bnegative) & $b) << 1); 1797 1657 … … 2081 1941 // } 2082 1942 $carry = 0; 2083 for ($i = 0; $i < 6 4; ++$i) {1943 for ($i = 0; $i < 63; ++$i) { 2084 1944 $e[$i] += $carry; 2085 1945 $carry = $e[$i] + 8; … … 2147 2007 2148 2008 for ($i = 0; $i < 32; ++$i) { 2149 /** @var int $dbl */2150 2009 $dbl = (int) $i << 1; 2151 2010 $e[$dbl] = (int) self::chrToInt($a[$i]) & 15; … … 2153 2012 } 2154 2013 2155 /** @var int $carry */2156 2014 $carry = 0; 2157 2015 for ($i = 0; $i < 63; ++$i) { 2158 2016 $e[$i] += $carry; 2159 /** @var int $carry */2160 2017 $carry = $e[$i] + 8; 2161 /** @var int $carry */2162 2018 $carry >>= 4; 2163 2019 $e[$i] -= $carry << 4; 2164 2020 } 2165 /** @var array<int, int> $e */2166 2021 $e[63] += (int) $carry; 2167 2022 … … 2207 2062 public static function sc_muladd($a, $b, $c) 2208 2063 { 2209 /** @var int $a0 */2210 2064 $a0 = 2097151 & self::load_3(self::substr($a, 0, 3)); 2211 /** @var int $a1 */2212 2065 $a1 = 2097151 & (self::load_4(self::substr($a, 2, 4)) >> 5); 2213 /** @var int $a2 */2214 2066 $a2 = 2097151 & (self::load_3(self::substr($a, 5, 3)) >> 2); 2215 /** @var int $a3 */2216 2067 $a3 = 2097151 & (self::load_4(self::substr($a, 7, 4)) >> 7); 2217 /** @var int $a4 */2218 2068 $a4 = 2097151 & (self::load_4(self::substr($a, 10, 4)) >> 4); 2219 /** @var int $a5 */2220 2069 $a5 = 2097151 & (self::load_3(self::substr($a, 13, 3)) >> 1); 2221 /** @var int $a6 */2222 2070 $a6 = 2097151 & (self::load_4(self::substr($a, 15, 4)) >> 6); 2223 /** @var int $a7 */2224 2071 $a7 = 2097151 & (self::load_3(self::substr($a, 18, 3)) >> 3); 2225 /** @var int $a8 */2226 2072 $a8 = 2097151 & self::load_3(self::substr($a, 21, 3)); 2227 /** @var int $a9 */2228 2073 $a9 = 2097151 & (self::load_4(self::substr($a, 23, 4)) >> 5); 2229 /** @var int $a10 */2230 2074 $a10 = 2097151 & (self::load_3(self::substr($a, 26, 3)) >> 2); 2231 /** @var int $a11 */2232 2075 $a11 = (self::load_4(self::substr($a, 28, 4)) >> 7); 2233 2076 2234 /** @var int $b0 */2235 2077 $b0 = 2097151 & self::load_3(self::substr($b, 0, 3)); 2236 /** @var int $b1 */2237 2078 $b1 = 2097151 & (self::load_4(self::substr($b, 2, 4)) >> 5); 2238 /** @var int $b2 */2239 2079 $b2 = 2097151 & (self::load_3(self::substr($b, 5, 3)) >> 2); 2240 /** @var int $b3 */2241 2080 $b3 = 2097151 & (self::load_4(self::substr($b, 7, 4)) >> 7); 2242 /** @var int $b4 */2243 2081 $b4 = 2097151 & (self::load_4(self::substr($b, 10, 4)) >> 4); 2244 /** @var int $b5 */2245 2082 $b5 = 2097151 & (self::load_3(self::substr($b, 13, 3)) >> 1); 2246 /** @var int $b6 */2247 2083 $b6 = 2097151 & (self::load_4(self::substr($b, 15, 4)) >> 6); 2248 /** @var int $b7 */2249 2084 $b7 = 2097151 & (self::load_3(self::substr($b, 18, 3)) >> 3); 2250 /** @var int $b8 */2251 2085 $b8 = 2097151 & self::load_3(self::substr($b, 21, 3)); 2252 /** @var int $b9 */2253 2086 $b9 = 2097151 & (self::load_4(self::substr($b, 23, 4)) >> 5); 2254 /** @var int $b10 */2255 2087 $b10 = 2097151 & (self::load_3(self::substr($b, 26, 3)) >> 2); 2256 /** @var int $b11 */2257 2088 $b11 = (self::load_4(self::substr($b, 28, 4)) >> 7); 2258 2089 2259 /** @var int $c0 */2260 2090 $c0 = 2097151 & self::load_3(self::substr($c, 0, 3)); 2261 /** @var int $c1 */2262 2091 $c1 = 2097151 & (self::load_4(self::substr($c, 2, 4)) >> 5); 2263 /** @var int $c2 */2264 2092 $c2 = 2097151 & (self::load_3(self::substr($c, 5, 3)) >> 2); 2265 /** @var int $c3 */2266 2093 $c3 = 2097151 & (self::load_4(self::substr($c, 7, 4)) >> 7); 2267 /** @var int $c4 */2268 2094 $c4 = 2097151 & (self::load_4(self::substr($c, 10, 4)) >> 4); 2269 /** @var int $c5 */2270 2095 $c5 = 2097151 & (self::load_3(self::substr($c, 13, 3)) >> 1); 2271 /** @var int $c6 */2272 2096 $c6 = 2097151 & (self::load_4(self::substr($c, 15, 4)) >> 6); 2273 /** @var int $c7 */2274 2097 $c7 = 2097151 & (self::load_3(self::substr($c, 18, 3)) >> 3); 2275 /** @var int $c8 */2276 2098 $c8 = 2097151 & self::load_3(self::substr($c, 21, 3)); 2277 /** @var int $c9 */2278 2099 $c9 = 2097151 & (self::load_4(self::substr($c, 23, 4)) >> 5); 2279 /** @var int $c10 */2280 2100 $c10 = 2097151 & (self::load_3(self::substr($c, 26, 3)) >> 2); 2281 /** @var int $c11 */2282 2101 $c11 = (self::load_4(self::substr($c, 28, 4)) >> 7); 2283 2102 … … 2330 2149 $s23 = 0; 2331 2150 2332 /** @var int $carry0 */2333 2151 $carry0 = ($s0 + (1 << 20)) >> 21; 2334 2152 $s1 += $carry0; 2335 2153 $s0 -= $carry0 << 21; 2336 /** @var int $carry2 */2337 2154 $carry2 = ($s2 + (1 << 20)) >> 21; 2338 2155 $s3 += $carry2; 2339 2156 $s2 -= $carry2 << 21; 2340 /** @var int $carry4 */2341 2157 $carry4 = ($s4 + (1 << 20)) >> 21; 2342 2158 $s5 += $carry4; 2343 2159 $s4 -= $carry4 << 21; 2344 /** @var int $carry6 */2345 2160 $carry6 = ($s6 + (1 << 20)) >> 21; 2346 2161 $s7 += $carry6; 2347 2162 $s6 -= $carry6 << 21; 2348 /** @var int $carry8 */2349 2163 $carry8 = ($s8 + (1 << 20)) >> 21; 2350 2164 $s9 += $carry8; 2351 2165 $s8 -= $carry8 << 21; 2352 /** @var int $carry10 */2353 2166 $carry10 = ($s10 + (1 << 20)) >> 21; 2354 2167 $s11 += $carry10; 2355 2168 $s10 -= $carry10 << 21; 2356 /** @var int $carry12 */2357 2169 $carry12 = ($s12 + (1 << 20)) >> 21; 2358 2170 $s13 += $carry12; 2359 2171 $s12 -= $carry12 << 21; 2360 /** @var int $carry14 */2361 2172 $carry14 = ($s14 + (1 << 20)) >> 21; 2362 2173 $s15 += $carry14; 2363 2174 $s14 -= $carry14 << 21; 2364 /** @var int $carry16 */2365 2175 $carry16 = ($s16 + (1 << 20)) >> 21; 2366 2176 $s17 += $carry16; 2367 2177 $s16 -= $carry16 << 21; 2368 /** @var int $carry18 */2369 2178 $carry18 = ($s18 + (1 << 20)) >> 21; 2370 2179 $s19 += $carry18; 2371 2180 $s18 -= $carry18 << 21; 2372 /** @var int $carry20 */2373 2181 $carry20 = ($s20 + (1 << 20)) >> 21; 2374 2182 $s21 += $carry20; 2375 2183 $s20 -= $carry20 << 21; 2376 /** @var int $carry22 */2377 2184 $carry22 = ($s22 + (1 << 20)) >> 21; 2378 2185 $s23 += $carry22; 2379 2186 $s22 -= $carry22 << 21; 2380 2187 2381 /** @var int $carry1 */2382 2188 $carry1 = ($s1 + (1 << 20)) >> 21; 2383 2189 $s2 += $carry1; 2384 2190 $s1 -= $carry1 << 21; 2385 /** @var int $carry3 */2386 2191 $carry3 = ($s3 + (1 << 20)) >> 21; 2387 2192 $s4 += $carry3; 2388 2193 $s3 -= $carry3 << 21; 2389 /** @var int $carry5 */2390 2194 $carry5 = ($s5 + (1 << 20)) >> 21; 2391 2195 $s6 += $carry5; 2392 2196 $s5 -= $carry5 << 21; 2393 /** @var int $carry7 */2394 2197 $carry7 = ($s7 + (1 << 20)) >> 21; 2395 2198 $s8 += $carry7; 2396 2199 $s7 -= $carry7 << 21; 2397 /** @var int $carry9 */2398 2200 $carry9 = ($s9 + (1 << 20)) >> 21; 2399 2201 $s10 += $carry9; 2400 2202 $s9 -= $carry9 << 21; 2401 /** @var int $carry11 */2402 2203 $carry11 = ($s11 + (1 << 20)) >> 21; 2403 2204 $s12 += $carry11; 2404 2205 $s11 -= $carry11 << 21; 2405 /** @var int $carry13 */2406 2206 $carry13 = ($s13 + (1 << 20)) >> 21; 2407 2207 $s14 += $carry13; 2408 2208 $s13 -= $carry13 << 21; 2409 /** @var int $carry15 */2410 2209 $carry15 = ($s15 + (1 << 20)) >> 21; 2411 2210 $s16 += $carry15; 2412 2211 $s15 -= $carry15 << 21; 2413 /** @var int $carry17 */2414 2212 $carry17 = ($s17 + (1 << 20)) >> 21; 2415 2213 $s18 += $carry17; 2416 2214 $s17 -= $carry17 << 21; 2417 /** @var int $carry19 */2418 2215 $carry19 = ($s19 + (1 << 20)) >> 21; 2419 2216 $s20 += $carry19; 2420 2217 $s19 -= $carry19 << 21; 2421 /** @var int $carry21 */2422 2218 $carry21 = ($s21 + (1 << 20)) >> 21; 2423 2219 $s22 += $carry21; … … 2466 2262 $s11 -= self::mul($s18, 683901, 20); 2467 2263 2468 /** @var int $carry6 */2469 2264 $carry6 = ($s6 + (1 << 20)) >> 21; 2470 2265 $s7 += $carry6; 2471 2266 $s6 -= $carry6 << 21; 2472 /** @var int $carry8 */2473 2267 $carry8 = ($s8 + (1 << 20)) >> 21; 2474 2268 $s9 += $carry8; 2475 2269 $s8 -= $carry8 << 21; 2476 /** @var int $carry10 */2477 2270 $carry10 = ($s10 + (1 << 20)) >> 21; 2478 2271 $s11 += $carry10; 2479 2272 $s10 -= $carry10 << 21; 2480 /** @var int $carry12 */2481 2273 $carry12 = ($s12 + (1 << 20)) >> 21; 2482 2274 $s13 += $carry12; 2483 2275 $s12 -= $carry12 << 21; 2484 /** @var int $carry14 */2485 2276 $carry14 = ($s14 + (1 << 20)) >> 21; 2486 2277 $s15 += $carry14; 2487 2278 $s14 -= $carry14 << 21; 2488 /** @var int $carry16 */2489 2279 $carry16 = ($s16 + (1 << 20)) >> 21; 2490 2280 $s17 += $carry16; 2491 2281 $s16 -= $carry16 << 21; 2492 2282 2493 /** @var int $carry7 */2494 2283 $carry7 = ($s7 + (1 << 20)) >> 21; 2495 2284 $s8 += $carry7; 2496 2285 $s7 -= $carry7 << 21; 2497 /** @var int $carry9 */2498 2286 $carry9 = ($s9 + (1 << 20)) >> 21; 2499 2287 $s10 += $carry9; 2500 2288 $s9 -= $carry9 << 21; 2501 /** @var int $carry11 */2502 2289 $carry11 = ($s11 + (1 << 20)) >> 21; 2503 2290 $s12 += $carry11; 2504 2291 $s11 -= $carry11 << 21; 2505 /** @var int $carry13 */2506 2292 $carry13 = ($s13 + (1 << 20)) >> 21; 2507 2293 $s14 += $carry13; 2508 2294 $s13 -= $carry13 << 21; 2509 /** @var int $carry15 */2510 2295 $carry15 = ($s15 + (1 << 20)) >> 21; 2511 2296 $s16 += $carry15; … … 2555 2340 $s12 = 0; 2556 2341 2557 /** @var int $carry0 */2558 2342 $carry0 = ($s0 + (1 << 20)) >> 21; 2559 2343 $s1 += $carry0; 2560 2344 $s0 -= $carry0 << 21; 2561 /** @var int $carry2 */2562 2345 $carry2 = ($s2 + (1 << 20)) >> 21; 2563 2346 $s3 += $carry2; 2564 2347 $s2 -= $carry2 << 21; 2565 /** @var int $carry4 */2566 2348 $carry4 = ($s4 + (1 << 20)) >> 21; 2567 2349 $s5 += $carry4; 2568 2350 $s4 -= $carry4 << 21; 2569 /** @var int $carry6 */2570 2351 $carry6 = ($s6 + (1 << 20)) >> 21; 2571 2352 $s7 += $carry6; 2572 2353 $s6 -= $carry6 << 21; 2573 /** @var int $carry8 */2574 2354 $carry8 = ($s8 + (1 << 20)) >> 21; 2575 2355 $s9 += $carry8; 2576 2356 $s8 -= $carry8 << 21; 2577 /** @var int $carry10 */2578 2357 $carry10 = ($s10 + (1 << 20)) >> 21; 2579 2358 $s11 += $carry10; 2580 2359 $s10 -= $carry10 << 21; 2581 2360 2582 /** @var int $carry1 */2583 2361 $carry1 = ($s1 + (1 << 20)) >> 21; 2584 2362 $s2 += $carry1; 2585 2363 $s1 -= $carry1 << 21; 2586 /** @var int $carry3 */2587 2364 $carry3 = ($s3 + (1 << 20)) >> 21; 2588 2365 $s4 += $carry3; 2589 2366 $s3 -= $carry3 << 21; 2590 /** @var int $carry5 */2591 2367 $carry5 = ($s5 + (1 << 20)) >> 21; 2592 2368 $s6 += $carry5; 2593 2369 $s5 -= $carry5 << 21; 2594 /** @var int $carry7 */2595 2370 $carry7 = ($s7 + (1 << 20)) >> 21; 2596 2371 $s8 += $carry7; 2597 2372 $s7 -= $carry7 << 21; 2598 /** @var int $carry9 */2599 2373 $carry9 = ($s9 + (1 << 20)) >> 21; 2600 2374 $s10 += $carry9; 2601 2375 $s9 -= $carry9 << 21; 2602 /** @var int $carry11 */2603 2376 $carry11 = ($s11 + (1 << 20)) >> 21; 2604 2377 $s12 += $carry11; … … 2613 2386 $s12 = 0; 2614 2387 2615 /** @var int $carry0 */2616 2388 $carry0 = $s0 >> 21; 2617 2389 $s1 += $carry0; 2618 2390 $s0 -= $carry0 << 21; 2619 /** @var int $carry1 */2620 2391 $carry1 = $s1 >> 21; 2621 2392 $s2 += $carry1; 2622 2393 $s1 -= $carry1 << 21; 2623 /** @var int $carry2 */2624 2394 $carry2 = $s2 >> 21; 2625 2395 $s3 += $carry2; 2626 2396 $s2 -= $carry2 << 21; 2627 /** @var int $carry3 */2628 2397 $carry3 = $s3 >> 21; 2629 2398 $s4 += $carry3; 2630 2399 $s3 -= $carry3 << 21; 2631 /** @var int $carry4 */2632 2400 $carry4 = $s4 >> 21; 2633 2401 $s5 += $carry4; 2634 2402 $s4 -= $carry4 << 21; 2635 /** @var int $carry5 */2636 2403 $carry5 = $s5 >> 21; 2637 2404 $s6 += $carry5; 2638 2405 $s5 -= $carry5 << 21; 2639 /** @var int $carry6 */2640 2406 $carry6 = $s6 >> 21; 2641 2407 $s7 += $carry6; 2642 2408 $s6 -= $carry6 << 21; 2643 /** @var int $carry7 */2644 2409 $carry7 = $s7 >> 21; 2645 2410 $s8 += $carry7; 2646 2411 $s7 -= $carry7 << 21; 2647 /** @var int $carry8 */2648 2412 $carry8 = $s8 >> 21; 2649 2413 $s9 += $carry8; 2650 2414 $s8 -= $carry8 << 21; 2651 /** @var int $carry9 */2652 2415 $carry9 = $s9 >> 21; 2653 2416 $s10 += $carry9; 2654 2417 $s9 -= $carry9 << 21; 2655 /** @var int $carry10 */2656 2418 $carry10 = $s10 >> 21; 2657 2419 $s11 += $carry10; 2658 2420 $s10 -= $carry10 << 21; 2659 /** @var int $carry11 */2660 2421 $carry11 = $s11 >> 21; 2661 2422 $s12 += $carry11; … … 2669 2430 $s5 -= self::mul($s12, 683901, 20); 2670 2431 2671 /** @var int $carry0 */2672 2432 $carry0 = $s0 >> 21; 2673 2433 $s1 += $carry0; 2674 2434 $s0 -= $carry0 << 21; 2675 /** @var int $carry1 */2676 2435 $carry1 = $s1 >> 21; 2677 2436 $s2 += $carry1; 2678 2437 $s1 -= $carry1 << 21; 2679 /** @var int $carry2 */2680 2438 $carry2 = $s2 >> 21; 2681 2439 $s3 += $carry2; 2682 2440 $s2 -= $carry2 << 21; 2683 /** @var int $carry3 */2684 2441 $carry3 = $s3 >> 21; 2685 2442 $s4 += $carry3; 2686 2443 $s3 -= $carry3 << 21; 2687 /** @var int $carry4 */2688 2444 $carry4 = $s4 >> 21; 2689 2445 $s5 += $carry4; 2690 2446 $s4 -= $carry4 << 21; 2691 /** @var int $carry5 */2692 2447 $carry5 = $s5 >> 21; 2693 2448 $s6 += $carry5; 2694 2449 $s5 -= $carry5 << 21; 2695 /** @var int $carry6 */2696 2450 $carry6 = $s6 >> 21; 2697 2451 $s7 += $carry6; 2698 2452 $s6 -= $carry6 << 21; 2699 /** @var int $carry7 */2700 2453 $carry7 = $s7 >> 21; 2701 2454 $s8 += $carry7; 2702 2455 $s7 -= $carry7 << 21; 2703 /** @var int $carry8 */2704 2456 $carry8 = $s8 >> 21; 2705 2457 $s9 += $carry8; 2706 2458 $s8 -= $carry8 << 21; 2707 /** @var int $carry9 */2708 2459 $carry9 = $s9 >> 21; 2709 2460 $s10 += $carry9; 2710 2461 $s9 -= $carry9 << 21; 2711 /** @var int $carry10 */2712 2462 $carry10 = $s10 >> 21; 2713 2463 $s11 += $carry10; … … 2763 2513 public static function sc_reduce($s) 2764 2514 { 2765 /** @var int $s0 */2766 2515 $s0 = 2097151 & self::load_3(self::substr($s, 0, 3)); 2767 /** @var int $s1 */2768 2516 $s1 = 2097151 & (self::load_4(self::substr($s, 2, 4)) >> 5); 2769 /** @var int $s2 */2770 2517 $s2 = 2097151 & (self::load_3(self::substr($s, 5, 3)) >> 2); 2771 /** @var int $s3 */2772 2518 $s3 = 2097151 & (self::load_4(self::substr($s, 7, 4)) >> 7); 2773 /** @var int $s4 */2774 2519 $s4 = 2097151 & (self::load_4(self::substr($s, 10, 4)) >> 4); 2775 /** @var int $s5 */2776 2520 $s5 = 2097151 & (self::load_3(self::substr($s, 13, 3)) >> 1); 2777 /** @var int $s6 */2778 2521 $s6 = 2097151 & (self::load_4(self::substr($s, 15, 4)) >> 6); 2779 /** @var int $s7 */2780 2522 $s7 = 2097151 & (self::load_3(self::substr($s, 18, 4)) >> 3); 2781 /** @var int $s8 */2782 2523 $s8 = 2097151 & self::load_3(self::substr($s, 21, 3)); 2783 /** @var int $s9 */2784 2524 $s9 = 2097151 & (self::load_4(self::substr($s, 23, 4)) >> 5); 2785 /** @var int $s10 */2786 2525 $s10 = 2097151 & (self::load_3(self::substr($s, 26, 3)) >> 2); 2787 /** @var int $s11 */2788 2526 $s11 = 2097151 & (self::load_4(self::substr($s, 28, 4)) >> 7); 2789 /** @var int $s12 */2790 2527 $s12 = 2097151 & (self::load_4(self::substr($s, 31, 4)) >> 4); 2791 /** @var int $s13 */2792 2528 $s13 = 2097151 & (self::load_3(self::substr($s, 34, 3)) >> 1); 2793 /** @var int $s14 */2794 2529 $s14 = 2097151 & (self::load_4(self::substr($s, 36, 4)) >> 6); 2795 /** @var int $s15 */2796 2530 $s15 = 2097151 & (self::load_3(self::substr($s, 39, 4)) >> 3); 2797 /** @var int $s16 */2798 2531 $s16 = 2097151 & self::load_3(self::substr($s, 42, 3)); 2799 /** @var int $s17 */2800 2532 $s17 = 2097151 & (self::load_4(self::substr($s, 44, 4)) >> 5); 2801 /** @var int $s18 */2802 2533 $s18 = 2097151 & (self::load_3(self::substr($s, 47, 3)) >> 2); 2803 /** @var int $s19 */2804 2534 $s19 = 2097151 & (self::load_4(self::substr($s, 49, 4)) >> 7); 2805 /** @var int $s20 */2806 2535 $s20 = 2097151 & (self::load_4(self::substr($s, 52, 4)) >> 4); 2807 /** @var int $s21 */2808 2536 $s21 = 2097151 & (self::load_3(self::substr($s, 55, 3)) >> 1); 2809 /** @var int $s22 */2810 2537 $s22 = 2097151 & (self::load_4(self::substr($s, 57, 4)) >> 6); 2811 /** @var int $s23 */2812 2538 $s23 = (self::load_4(self::substr($s, 60, 4)) >> 3); 2813 2539 … … 2854 2580 $s11 -= self::mul($s18, 683901, 20); 2855 2581 2856 /** @var int $carry6 */2857 2582 $carry6 = ($s6 + (1 << 20)) >> 21; 2858 2583 $s7 += $carry6; 2859 2584 $s6 -= $carry6 << 21; 2860 /** @var int $carry8 */2861 2585 $carry8 = ($s8 + (1 << 20)) >> 21; 2862 2586 $s9 += $carry8; 2863 2587 $s8 -= $carry8 << 21; 2864 /** @var int $carry10 */2865 2588 $carry10 = ($s10 + (1 << 20)) >> 21; 2866 2589 $s11 += $carry10; 2867 2590 $s10 -= $carry10 << 21; 2868 /** @var int $carry12 */2869 2591 $carry12 = ($s12 + (1 << 20)) >> 21; 2870 2592 $s13 += $carry12; 2871 2593 $s12 -= $carry12 << 21; 2872 /** @var int $carry14 */2873 2594 $carry14 = ($s14 + (1 << 20)) >> 21; 2874 2595 $s15 += $carry14; 2875 2596 $s14 -= $carry14 << 21; 2876 /** @var int $carry16 */2877 2597 $carry16 = ($s16 + (1 << 20)) >> 21; 2878 2598 $s17 += $carry16; 2879 2599 $s16 -= $carry16 << 21; 2880 2600 2881 /** @var int $carry7 */2882 2601 $carry7 = ($s7 + (1 << 20)) >> 21; 2883 2602 $s8 += $carry7; 2884 2603 $s7 -= $carry7 << 21; 2885 /** @var int $carry9 */2886 2604 $carry9 = ($s9 + (1 << 20)) >> 21; 2887 2605 $s10 += $carry9; 2888 2606 $s9 -= $carry9 << 21; 2889 /** @var int $carry11 */2890 2607 $carry11 = ($s11 + (1 << 20)) >> 21; 2891 2608 $s12 += $carry11; 2892 2609 $s11 -= $carry11 << 21; 2893 /** @var int $carry13 */2894 2610 $carry13 = ($s13 + (1 << 20)) >> 21; 2895 2611 $s14 += $carry13; 2896 2612 $s13 -= $carry13 << 21; 2897 /** @var int $carry15 */2898 2613 $carry15 = ($s15 + (1 << 20)) >> 21; 2899 2614 $s16 += $carry15; … … 2943 2658 $s12 = 0; 2944 2659 2945 /** @var int $carry0 */2946 2660 $carry0 = ($s0 + (1 << 20)) >> 21; 2947 2661 $s1 += $carry0; 2948 2662 $s0 -= $carry0 << 21; 2949 /** @var int $carry2 */2950 2663 $carry2 = ($s2 + (1 << 20)) >> 21; 2951 2664 $s3 += $carry2; 2952 2665 $s2 -= $carry2 << 21; 2953 /** @var int $carry4 */2954 2666 $carry4 = ($s4 + (1 << 20)) >> 21; 2955 2667 $s5 += $carry4; 2956 2668 $s4 -= $carry4 << 21; 2957 /** @var int $carry6 */2958 2669 $carry6 = ($s6 + (1 << 20)) >> 21; 2959 2670 $s7 += $carry6; 2960 2671 $s6 -= $carry6 << 21; 2961 /** @var int $carry8 */2962 2672 $carry8 = ($s8 + (1 << 20)) >> 21; 2963 2673 $s9 += $carry8; 2964 2674 $s8 -= $carry8 << 21; 2965 /** @var int $carry10 */2966 2675 $carry10 = ($s10 + (1 << 20)) >> 21; 2967 2676 $s11 += $carry10; 2968 2677 $s10 -= $carry10 << 21; 2969 2678 2970 /** @var int $carry1 */2971 2679 $carry1 = ($s1 + (1 << 20)) >> 21; 2972 2680 $s2 += $carry1; 2973 2681 $s1 -= $carry1 << 21; 2974 /** @var int $carry3 */2975 2682 $carry3 = ($s3 + (1 << 20)) >> 21; 2976 2683 $s4 += $carry3; 2977 2684 $s3 -= $carry3 << 21; 2978 /** @var int $carry5 */2979 2685 $carry5 = ($s5 + (1 << 20)) >> 21; 2980 2686 $s6 += $carry5; 2981 2687 $s5 -= $carry5 << 21; 2982 /** @var int $carry7 */2983 2688 $carry7 = ($s7 + (1 << 20)) >> 21; 2984 2689 $s8 += $carry7; 2985 2690 $s7 -= $carry7 << 21; 2986 /** @var int $carry9 */2987 2691 $carry9 = ($s9 + (1 << 20)) >> 21; 2988 2692 $s10 += $carry9; 2989 2693 $s9 -= $carry9 << 21; 2990 /** @var int $carry11 */2991 2694 $carry11 = ($s11 + (1 << 20)) >> 21; 2992 2695 $s12 += $carry11; … … 3001 2704 $s12 = 0; 3002 2705 3003 /** @var int $carry0 */3004 2706 $carry0 = $s0 >> 21; 3005 2707 $s1 += $carry0; 3006 2708 $s0 -= $carry0 << 21; 3007 /** @var int $carry1 */3008 2709 $carry1 = $s1 >> 21; 3009 2710 $s2 += $carry1; 3010 2711 $s1 -= $carry1 << 21; 3011 /** @var int $carry2 */3012 2712 $carry2 = $s2 >> 21; 3013 2713 $s3 += $carry2; 3014 2714 $s2 -= $carry2 << 21; 3015 /** @var int $carry3 */3016 2715 $carry3 = $s3 >> 21; 3017 2716 $s4 += $carry3; 3018 2717 $s3 -= $carry3 << 21; 3019 /** @var int $carry4 */3020 2718 $carry4 = $s4 >> 21; 3021 2719 $s5 += $carry4; 3022 2720 $s4 -= $carry4 << 21; 3023 /** @var int $carry5 */3024 2721 $carry5 = $s5 >> 21; 3025 2722 $s6 += $carry5; 3026 2723 $s5 -= $carry5 << 21; 3027 /** @var int $carry6 */3028 2724 $carry6 = $s6 >> 21; 3029 2725 $s7 += $carry6; 3030 2726 $s6 -= $carry6 << 21; 3031 /** @var int $carry7 */3032 2727 $carry7 = $s7 >> 21; 3033 2728 $s8 += $carry7; 3034 2729 $s7 -= $carry7 << 21; 3035 /** @var int $carry8 */3036 2730 $carry8 = $s8 >> 21; 3037 2731 $s9 += $carry8; 3038 2732 $s8 -= $carry8 << 21; 3039 /** @var int $carry9 */3040 2733 $carry9 = $s9 >> 21; 3041 2734 $s10 += $carry9; 3042 2735 $s9 -= $carry9 << 21; 3043 /** @var int $carry10 */3044 2736 $carry10 = $s10 >> 21; 3045 2737 $s11 += $carry10; 3046 2738 $s10 -= $carry10 << 21; 3047 /** @var int $carry11 */3048 2739 $carry11 = $s11 >> 21; 3049 2740 $s12 += $carry11; … … 3057 2748 $s5 -= self::mul($s12, 683901, 20); 3058 2749 3059 /** @var int $carry0 */3060 2750 $carry0 = $s0 >> 21; 3061 2751 $s1 += $carry0; 3062 2752 $s0 -= $carry0 << 21; 3063 /** @var int $carry1 */3064 2753 $carry1 = $s1 >> 21; 3065 2754 $s2 += $carry1; 3066 2755 $s1 -= $carry1 << 21; 3067 /** @var int $carry2 */3068 2756 $carry2 = $s2 >> 21; 3069 2757 $s3 += $carry2; 3070 2758 $s2 -= $carry2 << 21; 3071 /** @var int $carry3 */3072 2759 $carry3 = $s3 >> 21; 3073 2760 $s4 += $carry3; 3074 2761 $s3 -= $carry3 << 21; 3075 /** @var int $carry4 */3076 2762 $carry4 = $s4 >> 21; 3077 2763 $s5 += $carry4; 3078 2764 $s4 -= $carry4 << 21; 3079 /** @var int $carry5 */3080 2765 $carry5 = $s5 >> 21; 3081 2766 $s6 += $carry5; 3082 2767 $s5 -= $carry5 << 21; 3083 /** @var int $carry6 */3084 2768 $carry6 = $s6 >> 21; 3085 2769 $s7 += $carry6; 3086 2770 $s6 -= $carry6 << 21; 3087 /** @var int $carry7 */3088 2771 $carry7 = $s7 >> 21; 3089 2772 $s8 += $carry7; 3090 2773 $s7 -= $carry7 << 21; 3091 /** @var int $carry8 */3092 2774 $carry8 = $s8 >> 21; 3093 2775 $s9 += $carry8; 3094 2776 $s8 -= $carry8 << 21; 3095 /** @var int $carry9 */3096 2777 $carry9 = $s9 >> 21; 3097 2778 $s10 += $carry9; 3098 2779 $s9 -= $carry9 << 21; 3099 /** @var int $carry10 */3100 2780 $carry10 = $s10 >> 21; 3101 2781 $s11 += $carry10; … … 3150 2830 public static function ge_mul_l(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A) 3151 2831 { 3152 /** @var array<int, int> $aslide */3153 2832 $aslide = array( 3154 2833 13, 0, 0, 0, 0, -1, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0, -
trunk/src/wp-includes/sodium_compat/src/Core/Curve25519/Fe.php
r46586 r51591 61 61 * @psalm-suppress MixedArrayOffset 62 62 */ 63 #[ReturnTypeWillChange] 63 64 public function offsetSet($offset, $value) 64 65 { … … 80 81 * @psalm-suppress MixedArrayOffset 81 82 */ 83 #[ReturnTypeWillChange] 82 84 public function offsetExists($offset) 83 85 { … … 92 94 * @psalm-suppress MixedArrayOffset 93 95 */ 96 #[ReturnTypeWillChange] 94 97 public function offsetUnset($offset) 95 98 { … … 104 107 * @psalm-suppress MixedArrayOffset 105 108 */ 109 #[ReturnTypeWillChange] 106 110 public function offsetGet($offset) 107 111 { -
trunk/src/wp-includes/sodium_compat/src/Core/Util.php
r51002 r51591 288 288 289 289 /** 290 * Catch hash_update() failures and throw instead of silently proce ding290 * Catch hash_update() failures and throw instead of silently proceeding 291 291 * 292 292 * @param HashContext|resource &$hs … … 587 587 $b >>= 1; 588 588 } 589 $c = (int) @($c & -1); 589 590 590 591 /** … … 930 931 931 932 if ($mbstring === null) { 933 if (!defined('MB_OVERLOAD_STRING')) { 934 $mbstring = false; 935 return $mbstring; 936 } 932 937 $mbstring = extension_loaded('mbstring') 933 938 && defined('MB_OVERLOAD_STRING') -
trunk/src/wp-includes/sodium_compat/src/Core32/ChaCha20/Ctx.php
r46586 r51591 71 71 * @return void 72 72 */ 73 #[ReturnTypeWillChange] 73 74 public function offsetSet($offset, $value) 74 75 { … … 94 95 * @psalm-suppress MixedArrayOffset 95 96 */ 97 #[ReturnTypeWillChange] 96 98 public function offsetExists($offset) 97 99 { … … 106 108 * @psalm-suppress MixedArrayOffset 107 109 */ 110 #[ReturnTypeWillChange] 108 111 public function offsetUnset($offset) 109 112 { … … 118 121 * @psalm-suppress MixedArrayOffset 119 122 */ 123 #[ReturnTypeWillChange] 120 124 public function offsetGet($offset) 121 125 { -
trunk/src/wp-includes/sodium_compat/src/Core32/Curve25519/Fe.php
r46586 r51591 105 105 * @throws TypeError 106 106 */ 107 #[ReturnTypeWillChange] 107 108 public function offsetSet($offset, $value) 108 109 { … … 125 126 * @psalm-suppress MixedArrayOffset 126 127 */ 128 #[ReturnTypeWillChange] 127 129 public function offsetExists($offset) 128 130 { … … 137 139 * @psalm-suppress MixedArrayOffset 138 140 */ 141 #[ReturnTypeWillChange] 139 142 public function offsetUnset($offset) 140 143 { … … 149 152 * @psalm-suppress MixedArrayOffset 150 153 */ 154 #[ReturnTypeWillChange] 151 155 public function offsetGet($offset) 152 156 {
Note: See TracChangeset
for help on using the changeset viewer.