[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 namespace Sodium; 3 4 require_once dirname(dirname(__FILE__)) . '/autoload.php'; 5 6 use ParagonIE_Sodium_Compat; 7 8 /** 9 * This file will monkey patch the pure-PHP implementation in place of the 10 * PECL functions, but only if they do not already exist. 11 * 12 * Thus, the functions just proxy to the appropriate ParagonIE_Sodium_Compat 13 * method. 14 */ 15 if (!is_callable('\\Sodium\\bin2hex')) { 16 /** 17 * @see ParagonIE_Sodium_Compat::bin2hex() 18 * @param string $string 19 * @return string 20 * @throws \SodiumException 21 * @throws \TypeError 22 */ 23 function bin2hex( 24 #[\SensitiveParameter] 25 $string 26 ) { 27 return ParagonIE_Sodium_Compat::bin2hex($string); 28 } 29 } 30 if (!is_callable('\\Sodium\\compare')) { 31 /** 32 * @see ParagonIE_Sodium_Compat::compare() 33 * @param string $a 34 * @param string $b 35 * @return int 36 * @throws \SodiumException 37 * @throws \TypeError 38 */ 39 function compare( 40 #[\SensitiveParameter] 41 $a, 42 #[\SensitiveParameter] 43 $b 44 ) { 45 return ParagonIE_Sodium_Compat::compare($a, $b); 46 } 47 } 48 if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_decrypt')) { 49 /** 50 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt() 51 * @param string $message 52 * @param string $assocData 53 * @param string $nonce 54 * @param string $key 55 * @return string|bool 56 */ 57 function crypto_aead_aes256gcm_decrypt( 58 $message, 59 $assocData, 60 $nonce, 61 #[\SensitiveParameter] 62 $key 63 ) { 64 try { 65 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); 66 } catch (\TypeError $ex) { 67 return false; 68 } catch (\SodiumException $ex) { 69 return false; 70 } 71 } 72 } 73 if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_encrypt')) { 74 /** 75 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt() 76 * @param string $message 77 * @param string $assocData 78 * @param string $nonce 79 * @param string $key 80 * @return string 81 * @throws \SodiumException 82 * @throws \TypeError 83 */ 84 function crypto_aead_aes256gcm_encrypt( 85 #[\SensitiveParameter] 86 $message, 87 $assocData, 88 $nonce, 89 #[\SensitiveParameter] 90 $key 91 ) { 92 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); 93 } 94 } 95 if (!is_callable('\\Sodium\\crypto_aead_aes256gcm_is_available')) { 96 /** 97 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() 98 * @return bool 99 */ 100 function crypto_aead_aes256gcm_is_available() 101 { 102 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); 103 } 104 } 105 if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_decrypt')) { 106 /** 107 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt() 108 * @param string $message 109 * @param string $assocData 110 * @param string $nonce 111 * @param string $key 112 * @return string|bool 113 */ 114 function crypto_aead_chacha20poly1305_decrypt( 115 $message, 116 $assocData, 117 $nonce, 118 #[\SensitiveParameter] 119 $key 120 ) { 121 try { 122 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); 123 } catch (\TypeError $ex) { 124 return false; 125 } catch (\SodiumException $ex) { 126 return false; 127 } 128 } 129 } 130 if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_encrypt')) { 131 /** 132 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt() 133 * @param string $message 134 * @param string $assocData 135 * @param string $nonce 136 * @param string $key 137 * @return string 138 * @throws \SodiumException 139 * @throws \TypeError 140 */ 141 function crypto_aead_chacha20poly1305_encrypt( 142 #[\SensitiveParameter] 143 $message, 144 $assocData, 145 $nonce, 146 #[\SensitiveParameter] 147 $key 148 ) { 149 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); 150 } 151 } 152 if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_decrypt')) { 153 /** 154 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt() 155 * @param string $message 156 * @param string $assocData 157 * @param string $nonce 158 * @param string $key 159 * @return string|bool 160 */ 161 function crypto_aead_chacha20poly1305_ietf_decrypt( 162 $message, 163 $assocData, 164 $nonce, 165 #[\SensitiveParameter] 166 $key 167 ) { 168 try { 169 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); 170 } catch (\TypeError $ex) { 171 return false; 172 } catch (\SodiumException $ex) { 173 return false; 174 } 175 } 176 } 177 if (!is_callable('\\Sodium\\crypto_aead_chacha20poly1305_ietf_encrypt')) { 178 /** 179 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt() 180 * @param string $message 181 * @param string $assocData 182 * @param string $nonce 183 * @param string $key 184 * @return string 185 * @throws \SodiumException 186 * @throws \TypeError 187 */ 188 function crypto_aead_chacha20poly1305_ietf_encrypt( 189 #[\SensitiveParameter] 190 $message, 191 $assocData, 192 $nonce, 193 #[\SensitiveParameter] 194 $key 195 ) { 196 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); 197 } 198 } 199 if (!is_callable('\\Sodium\\crypto_auth')) { 200 /** 201 * @see ParagonIE_Sodium_Compat::crypto_auth() 202 * @param string $message 203 * @param string $key 204 * @return string 205 * @throws \SodiumException 206 * @throws \TypeError 207 */ 208 function crypto_auth( 209 $message, 210 #[\SensitiveParameter] 211 $key 212 ) { 213 return ParagonIE_Sodium_Compat::crypto_auth($message, $key); 214 } 215 } 216 if (!is_callable('\\Sodium\\crypto_auth_verify')) { 217 /** 218 * @see ParagonIE_Sodium_Compat::crypto_auth_verify() 219 * @param string $mac 220 * @param string $message 221 * @param string $key 222 * @return bool 223 * @throws \SodiumException 224 * @throws \TypeError 225 */ 226 function crypto_auth_verify( 227 $mac, 228 $message, 229 #[\SensitiveParameter] 230 $key 231 ) { 232 return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); 233 } 234 } 235 if (!is_callable('\\Sodium\\crypto_box')) { 236 /** 237 * @see ParagonIE_Sodium_Compat::crypto_box() 238 * @param string $message 239 * @param string $nonce 240 * @param string $kp 241 * @return string 242 * @throws \SodiumException 243 * @throws \TypeError 244 */ 245 function crypto_box( 246 #[\SensitiveParameter] 247 $message, 248 $nonce, 249 #[\SensitiveParameter] 250 $kp 251 ) { 252 return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); 253 } 254 } 255 if (!is_callable('\\Sodium\\crypto_box_keypair')) { 256 /** 257 * @see ParagonIE_Sodium_Compat::crypto_box_keypair() 258 * @return string 259 * @throws \SodiumException 260 * @throws \TypeError 261 */ 262 function crypto_box_keypair() 263 { 264 return ParagonIE_Sodium_Compat::crypto_box_keypair(); 265 } 266 } 267 if (!is_callable('\\Sodium\\crypto_box_keypair_from_secretkey_and_publickey')) { 268 /** 269 * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() 270 * @param string $sk 271 * @param string $pk 272 * @return string 273 * @throws \SodiumException 274 * @throws \TypeError 275 */ 276 function crypto_box_keypair_from_secretkey_and_publickey( 277 #[\SensitiveParameter] 278 $sk, 279 $pk 280 ) { 281 return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); 282 } 283 } 284 if (!is_callable('\\Sodium\\crypto_box_open')) { 285 /** 286 * @see ParagonIE_Sodium_Compat::crypto_box_open() 287 * @param string $message 288 * @param string $nonce 289 * @param string $kp 290 * @return string|bool 291 */ 292 function crypto_box_open( 293 #[\SensitiveParameter] 294 $message, 295 $nonce, 296 #[\SensitiveParameter] 297 $kp 298 ) { 299 try { 300 return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); 301 } catch (\TypeError $ex) { 302 return false; 303 } catch (\SodiumException $ex) { 304 return false; 305 } 306 } 307 } 308 if (!is_callable('\\Sodium\\crypto_box_publickey')) { 309 /** 310 * @see ParagonIE_Sodium_Compat::crypto_box_publickey() 311 * @param string $keypair 312 * @return string 313 * @throws \SodiumException 314 * @throws \TypeError 315 */ 316 function crypto_box_publickey( 317 #[\SensitiveParameter] 318 $keypair 319 ) { 320 return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); 321 } 322 } 323 if (!is_callable('\\Sodium\\crypto_box_publickey_from_secretkey')) { 324 /** 325 * @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey() 326 * @param string $sk 327 * @return string 328 * @throws \SodiumException 329 * @throws \TypeError 330 */ 331 function crypto_box_publickey_from_secretkey( 332 #[\SensitiveParameter] 333 $sk 334 ) { 335 return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); 336 } 337 } 338 if (!is_callable('\\Sodium\\crypto_box_seal')) { 339 /** 340 * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() 341 * @param string $message 342 * @param string $publicKey 343 * @return string 344 * @throws \SodiumException 345 * @throws \TypeError 346 */ 347 function crypto_box_seal( 348 #[\SensitiveParameter] 349 $message, 350 $publicKey 351 ) { 352 return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); 353 } 354 } 355 if (!is_callable('\\Sodium\\crypto_box_seal_open')) { 356 /** 357 * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() 358 * @param string $message 359 * @param string $kp 360 * @return string|bool 361 */ 362 function crypto_box_seal_open( 363 $message, 364 #[\SensitiveParameter] 365 $kp 366 ) { 367 try { 368 return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); 369 } catch (\TypeError $ex) { 370 return false; 371 } catch (\SodiumException $ex) { 372 return false; 373 } 374 } 375 } 376 if (!is_callable('\\Sodium\\crypto_box_secretkey')) { 377 /** 378 * @see ParagonIE_Sodium_Compat::crypto_box_secretkey() 379 * @param string $keypair 380 * @return string 381 * @throws \SodiumException 382 * @throws \TypeError 383 */ 384 function crypto_box_secretkey( 385 #[\SensitiveParameter] 386 $keypair 387 ) { 388 return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); 389 } 390 } 391 if (!is_callable('\\Sodium\\crypto_generichash')) { 392 /** 393 * @see ParagonIE_Sodium_Compat::crypto_generichash() 394 * @param string $message 395 * @param string|null $key 396 * @param int $outLen 397 * @return string 398 * @throws \SodiumException 399 * @throws \TypeError 400 */ 401 function crypto_generichash( 402 $message, 403 #[\SensitiveParameter] 404 $key = null, 405 $outLen = 32 406 ) { 407 return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); 408 } 409 } 410 if (!is_callable('\\Sodium\\crypto_generichash_final')) { 411 /** 412 * @see ParagonIE_Sodium_Compat::crypto_generichash_final() 413 * @param string|null $ctx 414 * @param int $outputLength 415 * @return string 416 * @throws \SodiumException 417 * @throws \TypeError 418 */ 419 function crypto_generichash_final( 420 #[\SensitiveParameter] 421 &$ctx, 422 $outputLength = 32 423 ) { 424 return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); 425 } 426 } 427 if (!is_callable('\\Sodium\\crypto_generichash_init')) { 428 /** 429 * @see ParagonIE_Sodium_Compat::crypto_generichash_init() 430 * @param string|null $key 431 * @param int $outLen 432 * @return string 433 * @throws \SodiumException 434 * @throws \TypeError 435 */ 436 function crypto_generichash_init( 437 #[\SensitiveParameter] 438 $key = null, 439 $outLen = 32 440 ) { 441 return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); 442 } 443 } 444 if (!is_callable('\\Sodium\\crypto_generichash_update')) { 445 /** 446 * @see ParagonIE_Sodium_Compat::crypto_generichash_update() 447 * @param string|null $ctx 448 * @param string $message 449 * @return void 450 * @throws \SodiumException 451 * @throws \TypeError 452 */ 453 function crypto_generichash_update( 454 #[\SensitiveParameter] 455 &$ctx, 456 $message = '' 457 ) { 458 ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); 459 } 460 } 461 if (!is_callable('\\Sodium\\crypto_kx')) { 462 /** 463 * @see ParagonIE_Sodium_Compat::crypto_kx() 464 * @param string $my_secret 465 * @param string $their_public 466 * @param string $client_public 467 * @param string $server_public 468 * @return string 469 * @throws \SodiumException 470 * @throws \TypeError 471 */ 472 function crypto_kx( 473 #[\SensitiveParameter] 474 $my_secret, 475 $their_public, 476 $client_public, 477 $server_public 478 ) { 479 return ParagonIE_Sodium_Compat::crypto_kx( 480 $my_secret, 481 $their_public, 482 $client_public, 483 $server_public, 484 true 485 ); 486 } 487 } 488 if (!is_callable('\\Sodium\\crypto_pwhash')) { 489 /** 490 * @see ParagonIE_Sodium_Compat::crypto_pwhash() 491 * @param int $outlen 492 * @param string $passwd 493 * @param string $salt 494 * @param int $opslimit 495 * @param int $memlimit 496 * @return string 497 * @throws \SodiumException 498 * @throws \TypeError 499 */ 500 function crypto_pwhash( 501 $outlen, 502 #[\SensitiveParameter] 503 $passwd, 504 $salt, 505 $opslimit, 506 $memlimit 507 ) { 508 return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit); 509 } 510 } 511 if (!is_callable('\\Sodium\\crypto_pwhash_str')) { 512 /** 513 * @see ParagonIE_Sodium_Compat::crypto_pwhash_str() 514 * @param string $passwd 515 * @param int $opslimit 516 * @param int $memlimit 517 * @return string 518 * @throws \SodiumException 519 * @throws \TypeError 520 */ 521 function crypto_pwhash_str( 522 #[\SensitiveParameter] 523 $passwd, 524 $opslimit, 525 $memlimit 526 ) { 527 return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); 528 } 529 } 530 if (!is_callable('\\Sodium\\crypto_pwhash_str_verify')) { 531 /** 532 * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_verify() 533 * @param string $passwd 534 * @param string $hash 535 * @return bool 536 * @throws \SodiumException 537 * @throws \TypeError 538 */ 539 function crypto_pwhash_str_verify( 540 #[\SensitiveParameter] 541 $passwd, 542 #[\SensitiveParameter] 543 $hash 544 ) { 545 return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); 546 } 547 } 548 if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256')) { 549 /** 550 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256() 551 * @param int $outlen 552 * @param string $passwd 553 * @param string $salt 554 * @param int $opslimit 555 * @param int $memlimit 556 * @return string 557 * @throws \SodiumException 558 * @throws \TypeError 559 */ 560 function crypto_pwhash_scryptsalsa208sha256( 561 $outlen, 562 #[\SensitiveParameter] 563 $passwd, 564 #[\SensitiveParameter] 565 $salt, 566 $opslimit, 567 $memlimit 568 ) { 569 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); 570 } 571 } 572 if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str')) { 573 /** 574 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str() 575 * @param string $passwd 576 * @param int $opslimit 577 * @param int $memlimit 578 * @return string 579 * @throws \SodiumException 580 * @throws \TypeError 581 */ 582 function crypto_pwhash_scryptsalsa208sha256_str( 583 #[\SensitiveParameter] 584 $passwd, 585 $opslimit, 586 $memlimit 587 ) { 588 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); 589 } 590 } 591 if (!is_callable('\\Sodium\\crypto_pwhash_scryptsalsa208sha256_str_verify')) { 592 /** 593 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify() 594 * @param string $passwd 595 * @param string $hash 596 * @return bool 597 * @throws \SodiumException 598 * @throws \TypeError 599 */ 600 function crypto_pwhash_scryptsalsa208sha256_str_verify( 601 #[\SensitiveParameter] 602 $passwd, 603 #[\SensitiveParameter] 604 $hash 605 ) { 606 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); 607 } 608 } 609 if (!is_callable('\\Sodium\\crypto_scalarmult')) { 610 /** 611 * @see ParagonIE_Sodium_Compat::crypto_scalarmult() 612 * @param string $n 613 * @param string $p 614 * @return string 615 * @throws \SodiumException 616 * @throws \TypeError 617 */ 618 function crypto_scalarmult( 619 #[\SensitiveParameter] 620 $n, 621 $p 622 ) { 623 return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); 624 } 625 } 626 if (!is_callable('\\Sodium\\crypto_scalarmult_base')) { 627 /** 628 * @see ParagonIE_Sodium_Compat::crypto_scalarmult_base() 629 * @param string $n 630 * @return string 631 * @throws \SodiumException 632 * @throws \TypeError 633 */ 634 function crypto_scalarmult_base( 635 #[\SensitiveParameter] 636 $n 637 ) { 638 return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); 639 } 640 } 641 if (!is_callable('\\Sodium\\crypto_secretbox')) { 642 /** 643 * @see ParagonIE_Sodium_Compat::crypto_secretbox() 644 * @param string $message 645 * @param string $nonce 646 * @param string $key 647 * @return string 648 * @throws \SodiumException 649 * @throws \TypeError 650 */ 651 function crypto_secretbox( 652 #[\SensitiveParameter] 653 $message, 654 $nonce, 655 #[\SensitiveParameter] 656 $key 657 ) { 658 return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); 659 } 660 } 661 if (!is_callable('\\Sodium\\crypto_secretbox_open')) { 662 /** 663 * @see ParagonIE_Sodium_Compat::crypto_secretbox_open() 664 * @param string $message 665 * @param string $nonce 666 * @param string $key 667 * @return string|bool 668 */ 669 function crypto_secretbox_open( 670 $message, 671 $nonce, 672 #[\SensitiveParameter] 673 $key 674 ) { 675 try { 676 return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); 677 } catch (\TypeError $ex) { 678 return false; 679 } catch (\SodiumException $ex) { 680 return false; 681 } 682 } 683 } 684 if (!is_callable('\\Sodium\\crypto_shorthash')) { 685 /** 686 * @see ParagonIE_Sodium_Compat::crypto_shorthash() 687 * @param string $message 688 * @param string $key 689 * @return string 690 * @throws \SodiumException 691 * @throws \TypeError 692 */ 693 function crypto_shorthash( 694 $message, 695 #[\SensitiveParameter] 696 $key = '' 697 ) { 698 return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); 699 } 700 } 701 if (!is_callable('\\Sodium\\crypto_sign')) { 702 /** 703 * @see ParagonIE_Sodium_Compat::crypto_sign() 704 * @param string $message 705 * @param string $sk 706 * @return string 707 * @throws \SodiumException 708 * @throws \TypeError 709 */ 710 function crypto_sign( 711 $message, 712 #[\SensitiveParameter] 713 $sk 714 ) { 715 return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); 716 } 717 } 718 if (!is_callable('\\Sodium\\crypto_sign_detached')) { 719 /** 720 * @see ParagonIE_Sodium_Compat::crypto_sign_detached() 721 * @param string $message 722 * @param string $sk 723 * @return string 724 * @throws \SodiumException 725 * @throws \TypeError 726 */ 727 function crypto_sign_detached( 728 $message, 729 #[\SensitiveParameter] 730 $sk 731 ) { 732 return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); 733 } 734 } 735 if (!is_callable('\\Sodium\\crypto_sign_keypair')) { 736 /** 737 * @see ParagonIE_Sodium_Compat::crypto_sign_keypair() 738 * @return string 739 * @throws \SodiumException 740 * @throws \TypeError 741 */ 742 function crypto_sign_keypair() 743 { 744 return ParagonIE_Sodium_Compat::crypto_sign_keypair(); 745 } 746 } 747 if (!is_callable('\\Sodium\\crypto_sign_open')) { 748 /** 749 * @see ParagonIE_Sodium_Compat::crypto_sign_open() 750 * @param string $signedMessage 751 * @param string $pk 752 * @return string|bool 753 */ 754 function crypto_sign_open($signedMessage, $pk) 755 { 756 try { 757 return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); 758 } catch (\TypeError $ex) { 759 return false; 760 } catch (\SodiumException $ex) { 761 return false; 762 } 763 } 764 } 765 if (!is_callable('\\Sodium\\crypto_sign_publickey')) { 766 /** 767 * @see ParagonIE_Sodium_Compat::crypto_sign_publickey() 768 * @param string $keypair 769 * @return string 770 * @throws \SodiumException 771 * @throws \TypeError 772 */ 773 function crypto_sign_publickey( 774 #[\SensitiveParameter] 775 $keypair 776 ) { 777 return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); 778 } 779 } 780 if (!is_callable('\\Sodium\\crypto_sign_publickey_from_secretkey')) { 781 /** 782 * @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey() 783 * @param string $sk 784 * @return string 785 * @throws \SodiumException 786 * @throws \TypeError 787 */ 788 function crypto_sign_publickey_from_secretkey( 789 #[\SensitiveParameter] 790 $sk 791 ) { 792 return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); 793 } 794 } 795 if (!is_callable('\\Sodium\\crypto_sign_secretkey')) { 796 /** 797 * @see ParagonIE_Sodium_Compat::crypto_sign_secretkey() 798 * @param string $keypair 799 * @return string 800 * @throws \SodiumException 801 * @throws \TypeError 802 */ 803 function crypto_sign_secretkey( 804 #[\SensitiveParameter] 805 $keypair 806 ) { 807 return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); 808 } 809 } 810 if (!is_callable('\\Sodium\\crypto_sign_seed_keypair')) { 811 /** 812 * @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair() 813 * @param string $seed 814 * @return string 815 * @throws \SodiumException 816 * @throws \TypeError 817 */ 818 function crypto_sign_seed_keypair( 819 #[\SensitiveParameter] 820 $seed 821 ) { 822 return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); 823 } 824 } 825 if (!is_callable('\\Sodium\\crypto_sign_verify_detached')) { 826 /** 827 * @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached() 828 * @param string $signature 829 * @param string $message 830 * @param string $pk 831 * @return bool 832 * @throws \SodiumException 833 * @throws \TypeError 834 */ 835 function crypto_sign_verify_detached($signature, $message, $pk) 836 { 837 return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); 838 } 839 } 840 if (!is_callable('\\Sodium\\crypto_sign_ed25519_pk_to_curve25519')) { 841 /** 842 * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() 843 * @param string $pk 844 * @return string 845 * @throws \SodiumException 846 * @throws \TypeError 847 */ 848 function crypto_sign_ed25519_pk_to_curve25519($pk) 849 { 850 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); 851 } 852 } 853 if (!is_callable('\\Sodium\\crypto_sign_ed25519_sk_to_curve25519')) { 854 /** 855 * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519() 856 * @param string $sk 857 * @return string 858 * @throws \SodiumException 859 * @throws \TypeError 860 */ 861 function crypto_sign_ed25519_sk_to_curve25519( 862 #[\SensitiveParameter] 863 $sk 864 ) { 865 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); 866 } 867 } 868 if (!is_callable('\\Sodium\\crypto_stream')) { 869 /** 870 * @see ParagonIE_Sodium_Compat::crypto_stream() 871 * @param int $len 872 * @param string $nonce 873 * @param string $key 874 * @return string 875 * @throws \SodiumException 876 * @throws \TypeError 877 */ 878 function crypto_stream( 879 $len, 880 $nonce, 881 #[\SensitiveParameter] 882 $key 883 ) { 884 return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); 885 } 886 } 887 if (!is_callable('\\Sodium\\crypto_stream_xor')) { 888 /** 889 * @see ParagonIE_Sodium_Compat::crypto_stream_xor() 890 * @param string $message 891 * @param string $nonce 892 * @param string $key 893 * @return string 894 * @throws \SodiumException 895 * @throws \TypeError 896 */ 897 function crypto_stream_xor( 898 #[\SensitiveParameter] 899 $message, 900 $nonce, 901 #[\SensitiveParameter] 902 $key 903 ) { 904 return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); 905 } 906 } 907 if (!is_callable('\\Sodium\\hex2bin')) { 908 /** 909 * @see ParagonIE_Sodium_Compat::hex2bin() 910 * @param string $string 911 * @return string 912 * @throws \SodiumException 913 * @throws \TypeError 914 */ 915 function hex2bin( 916 #[\SensitiveParameter] 917 $string 918 ) { 919 return ParagonIE_Sodium_Compat::hex2bin($string); 920 } 921 } 922 if (!is_callable('\\Sodium\\memcmp')) { 923 /** 924 * @see ParagonIE_Sodium_Compat::memcmp() 925 * @param string $a 926 * @param string $b 927 * @return int 928 * @throws \SodiumException 929 * @throws \TypeError 930 */ 931 function memcmp( 932 #[\SensitiveParameter] 933 $a, 934 #[\SensitiveParameter] 935 $b 936 ) { 937 return ParagonIE_Sodium_Compat::memcmp($a, $b); 938 } 939 } 940 if (!is_callable('\\Sodium\\memzero')) { 941 /** 942 * @see ParagonIE_Sodium_Compat::memzero() 943 * @param string $str 944 * @return void 945 * @throws \SodiumException 946 * @throws \TypeError 947 * 948 * @psalm-suppress MissingParamType 949 * @psalm-suppress MissingReturnType 950 * @psalm-suppress ReferenceConstraintViolation 951 */ 952 function memzero( 953 #[\SensitiveParameter] 954 &$str 955 ) { 956 ParagonIE_Sodium_Compat::memzero($str); 957 } 958 } 959 if (!is_callable('\\Sodium\\randombytes_buf')) { 960 /** 961 * @see ParagonIE_Sodium_Compat::randombytes_buf() 962 * @param int $amount 963 * @return string 964 * @throws \TypeError 965 */ 966 function randombytes_buf($amount) 967 { 968 return ParagonIE_Sodium_Compat::randombytes_buf($amount); 969 } 970 } 971 972 if (!is_callable('\\Sodium\\randombytes_uniform')) { 973 /** 974 * @see ParagonIE_Sodium_Compat::randombytes_uniform() 975 * @param int $upperLimit 976 * @return int 977 * @throws \SodiumException 978 * @throws \Error 979 */ 980 function randombytes_uniform($upperLimit) 981 { 982 return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); 983 } 984 } 985 986 if (!is_callable('\\Sodium\\randombytes_random16')) { 987 /** 988 * @see ParagonIE_Sodium_Compat::randombytes_random16() 989 * @return int 990 */ 991 function randombytes_random16() 992 { 993 return ParagonIE_Sodium_Compat::randombytes_random16(); 994 } 995 } 996 997 if (!defined('\\Sodium\\CRYPTO_AUTH_BYTES')) { 998 require_once dirname(__FILE__) . '/constants.php'; 999 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |