[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 3 require_once dirname(dirname(__FILE__)) . '/autoload.php'; 4 5 /** 6 * This file will monkey patch the pure-PHP implementation in place of the 7 * PECL functions and constants, but only if they do not already exist. 8 * 9 * Thus, the functions or constants just proxy to the appropriate 10 * ParagonIE_Sodium_Compat method or class constant, respectively. 11 */ 12 foreach (array( 13 'BASE64_VARIANT_ORIGINAL', 14 'BASE64_VARIANT_ORIGINAL_NO_PADDING', 15 'BASE64_VARIANT_URLSAFE', 16 'BASE64_VARIANT_URLSAFE_NO_PADDING', 17 'CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES', 18 'CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES', 19 'CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES', 20 'CRYPTO_AEAD_CHACHA20POLY1305_ABYTES', 21 'CRYPTO_AEAD_AES256GCM_KEYBYTES', 22 'CRYPTO_AEAD_AES256GCM_NSECBYTES', 23 'CRYPTO_AEAD_AES256GCM_NPUBBYTES', 24 'CRYPTO_AEAD_AES256GCM_ABYTES', 25 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES', 26 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', 27 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES', 28 'CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES', 29 'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES', 30 'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES', 31 'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES', 32 'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES', 33 'CRYPTO_AUTH_BYTES', 34 'CRYPTO_AUTH_KEYBYTES', 35 'CRYPTO_BOX_SEALBYTES', 36 'CRYPTO_BOX_SECRETKEYBYTES', 37 'CRYPTO_BOX_PUBLICKEYBYTES', 38 'CRYPTO_BOX_KEYPAIRBYTES', 39 'CRYPTO_BOX_MACBYTES', 40 'CRYPTO_BOX_NONCEBYTES', 41 'CRYPTO_BOX_SEEDBYTES', 42 'CRYPTO_KDF_BYTES_MIN', 43 'CRYPTO_KDF_BYTES_MAX', 44 'CRYPTO_KDF_CONTEXTBYTES', 45 'CRYPTO_KDF_KEYBYTES', 46 'CRYPTO_KX_BYTES', 47 'CRYPTO_KX_KEYPAIRBYTES', 48 'CRYPTO_KX_PRIMITIVE', 49 'CRYPTO_KX_SEEDBYTES', 50 'CRYPTO_KX_PUBLICKEYBYTES', 51 'CRYPTO_KX_SECRETKEYBYTES', 52 'CRYPTO_KX_SESSIONKEYBYTES', 53 'CRYPTO_GENERICHASH_BYTES', 54 'CRYPTO_GENERICHASH_BYTES_MIN', 55 'CRYPTO_GENERICHASH_BYTES_MAX', 56 'CRYPTO_GENERICHASH_KEYBYTES', 57 'CRYPTO_GENERICHASH_KEYBYTES_MIN', 58 'CRYPTO_GENERICHASH_KEYBYTES_MAX', 59 'CRYPTO_PWHASH_SALTBYTES', 60 'CRYPTO_PWHASH_STRPREFIX', 61 'CRYPTO_PWHASH_ALG_ARGON2I13', 62 'CRYPTO_PWHASH_ALG_ARGON2ID13', 63 'CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE', 64 'CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE', 65 'CRYPTO_PWHASH_MEMLIMIT_MODERATE', 66 'CRYPTO_PWHASH_OPSLIMIT_MODERATE', 67 'CRYPTO_PWHASH_MEMLIMIT_SENSITIVE', 68 'CRYPTO_PWHASH_OPSLIMIT_SENSITIVE', 69 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES', 70 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX', 71 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE', 72 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE', 73 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE', 74 'CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE', 75 'CRYPTO_SCALARMULT_BYTES', 76 'CRYPTO_SCALARMULT_SCALARBYTES', 77 'CRYPTO_SHORTHASH_BYTES', 78 'CRYPTO_SHORTHASH_KEYBYTES', 79 'CRYPTO_SECRETBOX_KEYBYTES', 80 'CRYPTO_SECRETBOX_MACBYTES', 81 'CRYPTO_SECRETBOX_NONCEBYTES', 82 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES', 83 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES', 84 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES', 85 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH', 86 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PULL', 87 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY', 88 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL', 89 'CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX', 90 'CRYPTO_SIGN_BYTES', 91 'CRYPTO_SIGN_SEEDBYTES', 92 'CRYPTO_SIGN_PUBLICKEYBYTES', 93 'CRYPTO_SIGN_SECRETKEYBYTES', 94 'CRYPTO_SIGN_KEYPAIRBYTES', 95 'CRYPTO_STREAM_KEYBYTES', 96 'CRYPTO_STREAM_NONCEBYTES', 97 'LIBRARY_MAJOR_VERSION', 98 'LIBRARY_MINOR_VERSION', 99 'LIBRARY_VERSION_MAJOR', 100 'LIBRARY_VERSION_MINOR', 101 'VERSION_STRING' 102 ) as $constant 103 ) { 104 if (!defined("SODIUM_$constant") && defined("ParagonIE_Sodium_Compat::$constant")) { 105 define("SODIUM_$constant", constant("ParagonIE_Sodium_Compat::$constant")); 106 } 107 } 108 if (!is_callable('sodium_add')) { 109 /** 110 * @see ParagonIE_Sodium_Compat::add() 111 * @param string $val 112 * @param string $addv 113 * @return void 114 * @throws SodiumException 115 */ 116 function sodium_add(&$val, $addv) 117 { 118 ParagonIE_Sodium_Compat::add($val, $addv); 119 } 120 } 121 if (!is_callable('sodium_base642bin')) { 122 /** 123 * @see ParagonIE_Sodium_Compat::bin2base64() 124 * @param string $string 125 * @param int $variant 126 * @param string $ignore 127 * @return string 128 * @throws SodiumException 129 * @throws TypeError 130 */ 131 function sodium_base642bin($string, $variant, $ignore ='') 132 { 133 return ParagonIE_Sodium_Compat::base642bin($string, $variant, $ignore); 134 } 135 } 136 if (!is_callable('sodium_bin2base64')) { 137 /** 138 * @see ParagonIE_Sodium_Compat::bin2base64() 139 * @param string $string 140 * @param int $variant 141 * @return string 142 * @throws SodiumException 143 * @throws TypeError 144 */ 145 function sodium_bin2base64($string, $variant) 146 { 147 return ParagonIE_Sodium_Compat::bin2base64($string, $variant); 148 } 149 } 150 if (!is_callable('sodium_bin2hex')) { 151 /** 152 * @see ParagonIE_Sodium_Compat::hex2bin() 153 * @param string $string 154 * @return string 155 * @throws SodiumException 156 * @throws TypeError 157 */ 158 function sodium_bin2hex($string) 159 { 160 return ParagonIE_Sodium_Compat::bin2hex($string); 161 } 162 } 163 if (!is_callable('sodium_compare')) { 164 /** 165 * @see ParagonIE_Sodium_Compat::compare() 166 * @param string $a 167 * @param string $b 168 * @return int 169 * @throws SodiumException 170 * @throws TypeError 171 */ 172 function sodium_compare($a, $b) 173 { 174 return ParagonIE_Sodium_Compat::compare($a, $b); 175 } 176 } 177 if (!is_callable('sodium_crypto_aead_aes256gcm_decrypt')) { 178 /** 179 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt() 180 * @param string $message 181 * @param string $assocData 182 * @param string $nonce 183 * @param string $key 184 * @return string|bool 185 */ 186 function sodium_crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key) 187 { 188 try { 189 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_decrypt($message, $assocData, $nonce, $key); 190 } catch (Error $ex) { 191 return false; 192 } catch (Exception $ex) { 193 return false; 194 } 195 } 196 } 197 if (!is_callable('sodium_crypto_aead_aes256gcm_encrypt')) { 198 /** 199 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt() 200 * @param string $message 201 * @param string $assocData 202 * @param string $nonce 203 * @param string $key 204 * @return string 205 * @throws SodiumException 206 * @throws TypeError 207 */ 208 function sodium_crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key) 209 { 210 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_encrypt($message, $assocData, $nonce, $key); 211 } 212 } 213 if (!is_callable('sodium_crypto_aead_aes256gcm_is_available')) { 214 /** 215 * @see ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available() 216 * @return bool 217 */ 218 function sodium_crypto_aead_aes256gcm_is_available() 219 { 220 return ParagonIE_Sodium_Compat::crypto_aead_aes256gcm_is_available(); 221 } 222 } 223 if (!is_callable('sodium_crypto_aead_chacha20poly1305_decrypt')) { 224 /** 225 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt() 226 * @param string $message 227 * @param string $assocData 228 * @param string $nonce 229 * @param string $key 230 * @return string|bool 231 */ 232 function sodium_crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key) 233 { 234 try { 235 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_decrypt($message, $assocData, $nonce, $key); 236 } catch (Error $ex) { 237 return false; 238 } catch (Exception $ex) { 239 return false; 240 } 241 } 242 } 243 if (!is_callable('sodium_crypto_aead_chacha20poly1305_encrypt')) { 244 /** 245 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt() 246 * @param string $message 247 * @param string $assocData 248 * @param string $nonce 249 * @param string $key 250 * @return string 251 * @throws SodiumException 252 * @throws TypeError 253 */ 254 function sodium_crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key) 255 { 256 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_encrypt($message, $assocData, $nonce, $key); 257 } 258 } 259 if (!is_callable('sodium_crypto_aead_chacha20poly1305_keygen')) { 260 /** 261 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen() 262 * @return string 263 * @throws Exception 264 */ 265 function sodium_crypto_aead_chacha20poly1305_keygen() 266 { 267 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_keygen(); 268 } 269 } 270 if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_decrypt')) { 271 /** 272 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt() 273 * @param string $message 274 * @param string $assocData 275 * @param string $nonce 276 * @param string $key 277 * @return string|bool 278 */ 279 function sodium_crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) 280 { 281 try { 282 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key); 283 } catch (Error $ex) { 284 return false; 285 } catch (Exception $ex) { 286 return false; 287 } 288 } 289 } 290 if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_encrypt')) { 291 /** 292 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt() 293 * @param string $message 294 * @param string $assocData 295 * @param string $nonce 296 * @param string $key 297 * @return string 298 * @throws SodiumException 299 * @throws TypeError 300 */ 301 function sodium_crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) 302 { 303 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key); 304 } 305 } 306 if (!is_callable('sodium_crypto_aead_chacha20poly1305_ietf_keygen')) { 307 /** 308 * @see ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen() 309 * @return string 310 * @throws Exception 311 */ 312 function sodium_crypto_aead_chacha20poly1305_ietf_keygen() 313 { 314 return ParagonIE_Sodium_Compat::crypto_aead_chacha20poly1305_ietf_keygen(); 315 } 316 } 317 if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_decrypt')) { 318 /** 319 * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt() 320 * @param string $message 321 * @param string $assocData 322 * @param string $nonce 323 * @param string $key 324 * @return string|bool 325 */ 326 function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key) 327 { 328 try { 329 return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt($message, $assocData, $nonce, $key, true); 330 } catch (Error $ex) { 331 return false; 332 } catch (Exception $ex) { 333 return false; 334 } 335 } 336 } 337 if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')) { 338 /** 339 * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt() 340 * @param string $message 341 * @param string $assocData 342 * @param string $nonce 343 * @param string $key 344 * @return string 345 * @throws SodiumException 346 * @throws TypeError 347 */ 348 function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key) 349 { 350 return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $assocData, $nonce, $key, true); 351 } 352 } 353 if (!is_callable('sodium_crypto_aead_xchacha20poly1305_ietf_keygen')) { 354 /** 355 * @see ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen() 356 * @return string 357 * @throws Exception 358 */ 359 function sodium_crypto_aead_xchacha20poly1305_ietf_keygen() 360 { 361 return ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_keygen(); 362 } 363 } 364 if (!is_callable('sodium_crypto_auth')) { 365 /** 366 * @see ParagonIE_Sodium_Compat::crypto_auth() 367 * @param string $message 368 * @param string $key 369 * @return string 370 * @throws SodiumException 371 * @throws TypeError 372 */ 373 function sodium_crypto_auth($message, $key) 374 { 375 return ParagonIE_Sodium_Compat::crypto_auth($message, $key); 376 } 377 } 378 if (!is_callable('sodium_crypto_auth_keygen')) { 379 /** 380 * @see ParagonIE_Sodium_Compat::crypto_auth_keygen() 381 * @return string 382 * @throws Exception 383 */ 384 function sodium_crypto_auth_keygen() 385 { 386 return ParagonIE_Sodium_Compat::crypto_auth_keygen(); 387 } 388 } 389 if (!is_callable('sodium_crypto_auth_verify')) { 390 /** 391 * @see ParagonIE_Sodium_Compat::crypto_auth_verify() 392 * @param string $mac 393 * @param string $message 394 * @param string $key 395 * @return bool 396 * @throws SodiumException 397 * @throws TypeError 398 */ 399 function sodium_crypto_auth_verify($mac, $message, $key) 400 { 401 return ParagonIE_Sodium_Compat::crypto_auth_verify($mac, $message, $key); 402 } 403 } 404 if (!is_callable('sodium_crypto_box')) { 405 /** 406 * @see ParagonIE_Sodium_Compat::crypto_box() 407 * @param string $message 408 * @param string $nonce 409 * @param string $kp 410 * @return string 411 * @throws SodiumException 412 * @throws TypeError 413 */ 414 function sodium_crypto_box($message, $nonce, $kp) 415 { 416 return ParagonIE_Sodium_Compat::crypto_box($message, $nonce, $kp); 417 } 418 } 419 if (!is_callable('sodium_crypto_box_keypair')) { 420 /** 421 * @see ParagonIE_Sodium_Compat::crypto_box_keypair() 422 * @return string 423 * @throws SodiumException 424 * @throws TypeError 425 */ 426 function sodium_crypto_box_keypair() 427 { 428 return ParagonIE_Sodium_Compat::crypto_box_keypair(); 429 } 430 } 431 if (!is_callable('sodium_crypto_box_keypair_from_secretkey_and_publickey')) { 432 /** 433 * @see ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey() 434 * @param string $sk 435 * @param string $pk 436 * @return string 437 * @throws SodiumException 438 * @throws TypeError 439 */ 440 function sodium_crypto_box_keypair_from_secretkey_and_publickey($sk, $pk) 441 { 442 return ParagonIE_Sodium_Compat::crypto_box_keypair_from_secretkey_and_publickey($sk, $pk); 443 } 444 } 445 if (!is_callable('sodium_crypto_box_open')) { 446 /** 447 * @see ParagonIE_Sodium_Compat::crypto_box_open() 448 * @param string $message 449 * @param string $nonce 450 * @param string $kp 451 * @return string|bool 452 */ 453 function sodium_crypto_box_open($message, $nonce, $kp) 454 { 455 try { 456 return ParagonIE_Sodium_Compat::crypto_box_open($message, $nonce, $kp); 457 } catch (Error $ex) { 458 return false; 459 } catch (Exception $ex) { 460 return false; 461 } 462 } 463 } 464 if (!is_callable('sodium_crypto_box_publickey')) { 465 /** 466 * @see ParagonIE_Sodium_Compat::crypto_box_publickey() 467 * @param string $keypair 468 * @return string 469 * @throws SodiumException 470 * @throws TypeError 471 */ 472 function sodium_crypto_box_publickey($keypair) 473 { 474 return ParagonIE_Sodium_Compat::crypto_box_publickey($keypair); 475 } 476 } 477 if (!is_callable('sodium_crypto_box_publickey_from_secretkey')) { 478 /** 479 * @see ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey() 480 * @param string $sk 481 * @return string 482 * @throws SodiumException 483 * @throws TypeError 484 */ 485 function sodium_crypto_box_publickey_from_secretkey($sk) 486 { 487 return ParagonIE_Sodium_Compat::crypto_box_publickey_from_secretkey($sk); 488 } 489 } 490 if (!is_callable('sodium_crypto_box_seal')) { 491 /** 492 * @see ParagonIE_Sodium_Compat::crypto_box_seal() 493 * @param string $message 494 * @param string $publicKey 495 * @return string 496 * @throws SodiumException 497 * @throws TypeError 498 */ 499 function sodium_crypto_box_seal($message, $publicKey) 500 { 501 return ParagonIE_Sodium_Compat::crypto_box_seal($message, $publicKey); 502 } 503 } 504 if (!is_callable('sodium_crypto_box_seal_open')) { 505 /** 506 * @see ParagonIE_Sodium_Compat::crypto_box_seal_open() 507 * @param string $message 508 * @param string $kp 509 * @return string|bool 510 * @throws SodiumException 511 */ 512 function sodium_crypto_box_seal_open($message, $kp) 513 { 514 try { 515 return ParagonIE_Sodium_Compat::crypto_box_seal_open($message, $kp); 516 } catch (SodiumException $ex) { 517 if ($ex->getMessage() === 'Argument 2 must be CRYPTO_BOX_KEYPAIRBYTES long.') { 518 throw $ex; 519 } 520 return false; 521 } 522 } 523 } 524 if (!is_callable('sodium_crypto_box_secretkey')) { 525 /** 526 * @see ParagonIE_Sodium_Compat::crypto_box_secretkey() 527 * @param string $keypair 528 * @return string 529 * @throws SodiumException 530 * @throws TypeError 531 */ 532 function sodium_crypto_box_secretkey($keypair) 533 { 534 return ParagonIE_Sodium_Compat::crypto_box_secretkey($keypair); 535 } 536 } 537 if (!is_callable('sodium_crypto_box_seed_keypair')) { 538 /** 539 * @see ParagonIE_Sodium_Compat::crypto_box_seed_keypair() 540 * @param string $seed 541 * @return string 542 * @throws SodiumException 543 * @throws TypeError 544 */ 545 function sodium_crypto_box_seed_keypair($seed) 546 { 547 return ParagonIE_Sodium_Compat::crypto_box_seed_keypair($seed); 548 } 549 } 550 if (!is_callable('sodium_crypto_generichash')) { 551 /** 552 * @see ParagonIE_Sodium_Compat::crypto_generichash() 553 * @param string $message 554 * @param string|null $key 555 * @param int $outLen 556 * @return string 557 * @throws SodiumException 558 * @throws TypeError 559 */ 560 function sodium_crypto_generichash($message, $key = null, $outLen = 32) 561 { 562 return ParagonIE_Sodium_Compat::crypto_generichash($message, $key, $outLen); 563 } 564 } 565 if (!is_callable('sodium_crypto_generichash_final')) { 566 /** 567 * @see ParagonIE_Sodium_Compat::crypto_generichash_final() 568 * @param string|null $ctx 569 * @param int $outputLength 570 * @return string 571 * @throws SodiumException 572 * @throws TypeError 573 */ 574 function sodium_crypto_generichash_final(&$ctx, $outputLength = 32) 575 { 576 return ParagonIE_Sodium_Compat::crypto_generichash_final($ctx, $outputLength); 577 } 578 } 579 if (!is_callable('sodium_crypto_generichash_init')) { 580 /** 581 * @see ParagonIE_Sodium_Compat::crypto_generichash_init() 582 * @param string|null $key 583 * @param int $outLen 584 * @return string 585 * @throws SodiumException 586 * @throws TypeError 587 */ 588 function sodium_crypto_generichash_init($key = null, $outLen = 32) 589 { 590 return ParagonIE_Sodium_Compat::crypto_generichash_init($key, $outLen); 591 } 592 } 593 if (!is_callable('sodium_crypto_generichash_keygen')) { 594 /** 595 * @see ParagonIE_Sodium_Compat::crypto_generichash_keygen() 596 * @return string 597 * @throws Exception 598 */ 599 function sodium_crypto_generichash_keygen() 600 { 601 return ParagonIE_Sodium_Compat::crypto_generichash_keygen(); 602 } 603 } 604 if (!is_callable('sodium_crypto_generichash_update')) { 605 /** 606 * @see ParagonIE_Sodium_Compat::crypto_generichash_update() 607 * @param string|null $ctx 608 * @param string $message 609 * @return void 610 * @throws SodiumException 611 * @throws TypeError 612 */ 613 function sodium_crypto_generichash_update(&$ctx, $message = '') 614 { 615 ParagonIE_Sodium_Compat::crypto_generichash_update($ctx, $message); 616 } 617 } 618 if (!is_callable('sodium_crypto_kdf_keygen')) { 619 /** 620 * @see ParagonIE_Sodium_Compat::crypto_kdf_keygen() 621 * @return string 622 * @throws Exception 623 */ 624 function sodium_crypto_kdf_keygen() 625 { 626 return ParagonIE_Sodium_Compat::crypto_kdf_keygen(); 627 } 628 } 629 if (!is_callable('sodium_crypto_kdf_derive_from_key')) { 630 /** 631 * @see ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key() 632 * @param int $subkey_len 633 * @param int $subkey_id 634 * @param string $context 635 * @param string $key 636 * @return string 637 * @throws Exception 638 */ 639 function sodium_crypto_kdf_derive_from_key($subkey_len, $subkey_id, $context, $key) 640 { 641 return ParagonIE_Sodium_Compat::crypto_kdf_derive_from_key( 642 $subkey_len, 643 $subkey_id, 644 $context, 645 $key 646 ); 647 } 648 } 649 if (!is_callable('sodium_crypto_kx')) { 650 /** 651 * @see ParagonIE_Sodium_Compat::crypto_kx() 652 * @param string $my_secret 653 * @param string $their_public 654 * @param string $client_public 655 * @param string $server_public 656 * @return string 657 * @throws SodiumException 658 * @throws TypeError 659 */ 660 function sodium_crypto_kx($my_secret, $their_public, $client_public, $server_public) 661 { 662 return ParagonIE_Sodium_Compat::crypto_kx( 663 $my_secret, 664 $their_public, 665 $client_public, 666 $server_public 667 ); 668 } 669 } 670 if (!is_callable('sodium_crypto_kx_seed_keypair')) { 671 /** 672 * @param string $seed 673 * @return string 674 * @throws Exception 675 */ 676 function sodium_crypto_kx_seed_keypair($seed) 677 { 678 return ParagonIE_Sodium_Compat::crypto_kx_seed_keypair($seed); 679 } 680 } 681 if (!is_callable('sodium_crypto_kx_keypair')) { 682 /** 683 * @return string 684 * @throws Exception 685 */ 686 function sodium_crypto_kx_keypair() 687 { 688 return ParagonIE_Sodium_Compat::crypto_kx_keypair(); 689 } 690 } 691 if (!is_callable('sodium_crypto_kx_client_session_keys')) { 692 /** 693 * @param string $keypair 694 * @param string $serverPublicKey 695 * @return array{0: string, 1: string} 696 * @throws SodiumException 697 */ 698 function sodium_crypto_kx_client_session_keys($keypair, $serverPublicKey) 699 { 700 return ParagonIE_Sodium_Compat::crypto_kx_client_session_keys($keypair, $serverPublicKey); 701 } 702 } 703 if (!is_callable('sodium_crypto_kx_server_session_keys')) { 704 /** 705 * @param string $keypair 706 * @param string $clientPublicKey 707 * @return array{0: string, 1: string} 708 * @throws SodiumException 709 */ 710 function sodium_crypto_kx_server_session_keys($keypair, $clientPublicKey) 711 { 712 return ParagonIE_Sodium_Compat::crypto_kx_server_session_keys($keypair, $clientPublicKey); 713 } 714 } 715 if (!is_callable('sodium_crypto_kx_secretkey')) { 716 /** 717 * @param string $keypair 718 * @return string 719 * @throws Exception 720 */ 721 function sodium_crypto_kx_secretkey($keypair) 722 { 723 return ParagonIE_Sodium_Compat::crypto_kx_secretkey($keypair); 724 } 725 } 726 if (!is_callable('sodium_crypto_kx_publickey')) { 727 /** 728 * @param string $keypair 729 * @return string 730 * @throws Exception 731 */ 732 function sodium_crypto_kx_publickey($keypair) 733 { 734 return ParagonIE_Sodium_Compat::crypto_kx_publickey($keypair); 735 } 736 } 737 if (!is_callable('sodium_crypto_pwhash')) { 738 /** 739 * @see ParagonIE_Sodium_Compat::crypto_pwhash() 740 * @param int $outlen 741 * @param string $passwd 742 * @param string $salt 743 * @param int $opslimit 744 * @param int $memlimit 745 * @param int|null $algo 746 * @return string 747 * @throws SodiumException 748 * @throws TypeError 749 */ 750 function sodium_crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo = null) 751 { 752 return ParagonIE_Sodium_Compat::crypto_pwhash($outlen, $passwd, $salt, $opslimit, $memlimit, $algo); 753 } 754 } 755 if (!is_callable('sodium_crypto_pwhash_str')) { 756 /** 757 * @see ParagonIE_Sodium_Compat::crypto_pwhash_str() 758 * @param string $passwd 759 * @param int $opslimit 760 * @param int $memlimit 761 * @return string 762 * @throws SodiumException 763 * @throws TypeError 764 */ 765 function sodium_crypto_pwhash_str($passwd, $opslimit, $memlimit) 766 { 767 return ParagonIE_Sodium_Compat::crypto_pwhash_str($passwd, $opslimit, $memlimit); 768 } 769 } 770 if (!is_callable('sodium_crypto_pwhash_str_needs_rehash')) { 771 /** 772 * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash() 773 * @param string $hash 774 * @param int $opslimit 775 * @param int $memlimit 776 * @return bool 777 * 778 * @throws SodiumException 779 */ 780 function sodium_crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit) 781 { 782 return ParagonIE_Sodium_Compat::crypto_pwhash_str_needs_rehash($hash, $opslimit, $memlimit); 783 } 784 } 785 if (!is_callable('sodium_crypto_pwhash_str_verify')) { 786 /** 787 * @see ParagonIE_Sodium_Compat::crypto_pwhash_str_verify() 788 * @param string $passwd 789 * @param string $hash 790 * @return bool 791 * @throws SodiumException 792 * @throws TypeError 793 */ 794 function sodium_crypto_pwhash_str_verify($passwd, $hash) 795 { 796 return ParagonIE_Sodium_Compat::crypto_pwhash_str_verify($passwd, $hash); 797 } 798 } 799 if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256')) { 800 /** 801 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256() 802 * @param int $outlen 803 * @param string $passwd 804 * @param string $salt 805 * @param int $opslimit 806 * @param int $memlimit 807 * @return string 808 * @throws SodiumException 809 * @throws TypeError 810 */ 811 function sodium_crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit) 812 { 813 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256($outlen, $passwd, $salt, $opslimit, $memlimit); 814 } 815 } 816 if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str')) { 817 /** 818 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str() 819 * @param string $passwd 820 * @param int $opslimit 821 * @param int $memlimit 822 * @return string 823 * @throws SodiumException 824 * @throws TypeError 825 */ 826 function sodium_crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit) 827 { 828 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str($passwd, $opslimit, $memlimit); 829 } 830 } 831 if (!is_callable('sodium_crypto_pwhash_scryptsalsa208sha256_str_verify')) { 832 /** 833 * @see ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify() 834 * @param string $passwd 835 * @param string $hash 836 * @return bool 837 * @throws SodiumException 838 * @throws TypeError 839 */ 840 function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash) 841 { 842 return ParagonIE_Sodium_Compat::crypto_pwhash_scryptsalsa208sha256_str_verify($passwd, $hash); 843 } 844 } 845 if (!is_callable('sodium_crypto_scalarmult')) { 846 /** 847 * @see ParagonIE_Sodium_Compat::crypto_scalarmult() 848 * @param string $n 849 * @param string $p 850 * @return string 851 * @throws SodiumException 852 * @throws TypeError 853 */ 854 function sodium_crypto_scalarmult($n, $p) 855 { 856 return ParagonIE_Sodium_Compat::crypto_scalarmult($n, $p); 857 } 858 } 859 if (!is_callable('sodium_crypto_scalarmult_base')) { 860 /** 861 * @see ParagonIE_Sodium_Compat::crypto_scalarmult_base() 862 * @param string $n 863 * @return string 864 * @throws SodiumException 865 * @throws TypeError 866 */ 867 function sodium_crypto_scalarmult_base($n) 868 { 869 return ParagonIE_Sodium_Compat::crypto_scalarmult_base($n); 870 } 871 } 872 if (!is_callable('sodium_crypto_secretbox')) { 873 /** 874 * @see ParagonIE_Sodium_Compat::crypto_secretbox() 875 * @param string $message 876 * @param string $nonce 877 * @param string $key 878 * @return string 879 * @throws SodiumException 880 * @throws TypeError 881 */ 882 function sodium_crypto_secretbox($message, $nonce, $key) 883 { 884 return ParagonIE_Sodium_Compat::crypto_secretbox($message, $nonce, $key); 885 } 886 } 887 if (!is_callable('sodium_crypto_secretbox_keygen')) { 888 /** 889 * @see ParagonIE_Sodium_Compat::crypto_secretbox_keygen() 890 * @return string 891 * @throws Exception 892 */ 893 function sodium_crypto_secretbox_keygen() 894 { 895 return ParagonIE_Sodium_Compat::crypto_secretbox_keygen(); 896 } 897 } 898 if (!is_callable('sodium_crypto_secretbox_open')) { 899 /** 900 * @see ParagonIE_Sodium_Compat::crypto_secretbox_open() 901 * @param string $message 902 * @param string $nonce 903 * @param string $key 904 * @return string|bool 905 */ 906 function sodium_crypto_secretbox_open($message, $nonce, $key) 907 { 908 try { 909 return ParagonIE_Sodium_Compat::crypto_secretbox_open($message, $nonce, $key); 910 } catch (Error $ex) { 911 return false; 912 } catch (Exception $ex) { 913 return false; 914 } 915 } 916 } 917 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_push')) { 918 /** 919 * @param string $key 920 * @return array<int, string> 921 * @throws SodiumException 922 */ 923 function sodium_crypto_secretstream_xchacha20poly1305_init_push($key) 924 { 925 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_push($key); 926 } 927 } 928 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_push')) { 929 /** 930 * @param string $state 931 * @param string $msg 932 * @param string $aad 933 * @param int $tag 934 * @return string 935 * @throws SodiumException 936 */ 937 function sodium_crypto_secretstream_xchacha20poly1305_push(&$state, $msg, $aad = '', $tag = 0) 938 { 939 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_push($state, $msg, $aad, $tag); 940 } 941 } 942 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_init_pull')) { 943 /** 944 * @param string $header 945 * @param string $key 946 * @return string 947 * @throws Exception 948 */ 949 function sodium_crypto_secretstream_xchacha20poly1305_init_pull($header, $key) 950 { 951 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_init_pull($header, $key); 952 } 953 } 954 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_pull')) { 955 /** 956 * @param string $state 957 * @param string $cipher 958 * @param string $aad 959 * @return bool|array{0: string, 1: int} 960 * @throws SodiumException 961 */ 962 function sodium_crypto_secretstream_xchacha20poly1305_pull(&$state, $cipher, $aad = '') 963 { 964 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_pull($state, $cipher, $aad); 965 } 966 } 967 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_rekey')) { 968 /** 969 * @param string $state 970 * @return void 971 * @throws SodiumException 972 */ 973 function sodium_crypto_secretstream_xchacha20poly1305_rekey(&$state) 974 { 975 ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_rekey($state); 976 } 977 } 978 if (!is_callable('sodium_crypto_secretstream_xchacha20poly1305_keygen')) { 979 /** 980 * @return string 981 * @throws Exception 982 */ 983 function sodium_crypto_secretstream_xchacha20poly1305_keygen() 984 { 985 return ParagonIE_Sodium_Compat::crypto_secretstream_xchacha20poly1305_keygen(); 986 } 987 } 988 if (!is_callable('sodium_crypto_shorthash')) { 989 /** 990 * @see ParagonIE_Sodium_Compat::crypto_shorthash() 991 * @param string $message 992 * @param string $key 993 * @return string 994 * @throws SodiumException 995 * @throws TypeError 996 */ 997 function sodium_crypto_shorthash($message, $key = '') 998 { 999 return ParagonIE_Sodium_Compat::crypto_shorthash($message, $key); 1000 } 1001 } 1002 if (!is_callable('sodium_crypto_shorthash_keygen')) { 1003 /** 1004 * @see ParagonIE_Sodium_Compat::crypto_shorthash_keygen() 1005 * @return string 1006 * @throws Exception 1007 */ 1008 function sodium_crypto_shorthash_keygen() 1009 { 1010 return ParagonIE_Sodium_Compat::crypto_shorthash_keygen(); 1011 } 1012 } 1013 if (!is_callable('sodium_crypto_sign')) { 1014 /** 1015 * @see ParagonIE_Sodium_Compat::crypto_sign() 1016 * @param string $message 1017 * @param string $sk 1018 * @return string 1019 * @throws SodiumException 1020 * @throws TypeError 1021 */ 1022 function sodium_crypto_sign($message, $sk) 1023 { 1024 return ParagonIE_Sodium_Compat::crypto_sign($message, $sk); 1025 } 1026 } 1027 if (!is_callable('sodium_crypto_sign_detached')) { 1028 /** 1029 * @see ParagonIE_Sodium_Compat::crypto_sign_detached() 1030 * @param string $message 1031 * @param string $sk 1032 * @return string 1033 * @throws SodiumException 1034 * @throws TypeError 1035 */ 1036 function sodium_crypto_sign_detached($message, $sk) 1037 { 1038 return ParagonIE_Sodium_Compat::crypto_sign_detached($message, $sk); 1039 } 1040 } 1041 if (!is_callable('sodium_crypto_sign_keypair_from_secretkey_and_publickey')) { 1042 /** 1043 * @see ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey() 1044 * @param string $sk 1045 * @param string $pk 1046 * @return string 1047 * @throws SodiumException 1048 * @throws TypeError 1049 */ 1050 function sodium_crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk) 1051 { 1052 return ParagonIE_Sodium_Compat::crypto_sign_keypair_from_secretkey_and_publickey($sk, $pk); 1053 } 1054 } 1055 if (!is_callable('sodium_crypto_sign_keypair')) { 1056 /** 1057 * @see ParagonIE_Sodium_Compat::crypto_sign_keypair() 1058 * @return string 1059 * @throws SodiumException 1060 * @throws TypeError 1061 */ 1062 function sodium_crypto_sign_keypair() 1063 { 1064 return ParagonIE_Sodium_Compat::crypto_sign_keypair(); 1065 } 1066 } 1067 if (!is_callable('sodium_crypto_sign_open')) { 1068 /** 1069 * @see ParagonIE_Sodium_Compat::crypto_sign_open() 1070 * @param string $signedMessage 1071 * @param string $pk 1072 * @return string|bool 1073 */ 1074 function sodium_crypto_sign_open($signedMessage, $pk) 1075 { 1076 try { 1077 return ParagonIE_Sodium_Compat::crypto_sign_open($signedMessage, $pk); 1078 } catch (Error $ex) { 1079 return false; 1080 } catch (Exception $ex) { 1081 return false; 1082 } 1083 } 1084 } 1085 if (!is_callable('sodium_crypto_sign_publickey')) { 1086 /** 1087 * @see ParagonIE_Sodium_Compat::crypto_sign_publickey() 1088 * @param string $keypair 1089 * @return string 1090 * @throws SodiumException 1091 * @throws TypeError 1092 */ 1093 function sodium_crypto_sign_publickey($keypair) 1094 { 1095 return ParagonIE_Sodium_Compat::crypto_sign_publickey($keypair); 1096 } 1097 } 1098 if (!is_callable('sodium_crypto_sign_publickey_from_secretkey')) { 1099 /** 1100 * @see ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey() 1101 * @param string $sk 1102 * @return string 1103 * @throws SodiumException 1104 * @throws TypeError 1105 */ 1106 function sodium_crypto_sign_publickey_from_secretkey($sk) 1107 { 1108 return ParagonIE_Sodium_Compat::crypto_sign_publickey_from_secretkey($sk); 1109 } 1110 } 1111 if (!is_callable('sodium_crypto_sign_secretkey')) { 1112 /** 1113 * @see ParagonIE_Sodium_Compat::crypto_sign_secretkey() 1114 * @param string $keypair 1115 * @return string 1116 * @throws SodiumException 1117 * @throws TypeError 1118 */ 1119 function sodium_crypto_sign_secretkey($keypair) 1120 { 1121 return ParagonIE_Sodium_Compat::crypto_sign_secretkey($keypair); 1122 } 1123 } 1124 if (!is_callable('sodium_crypto_sign_seed_keypair')) { 1125 /** 1126 * @see ParagonIE_Sodium_Compat::crypto_sign_seed_keypair() 1127 * @param string $seed 1128 * @return string 1129 * @throws SodiumException 1130 * @throws TypeError 1131 */ 1132 function sodium_crypto_sign_seed_keypair($seed) 1133 { 1134 return ParagonIE_Sodium_Compat::crypto_sign_seed_keypair($seed); 1135 } 1136 } 1137 if (!is_callable('sodium_crypto_sign_verify_detached')) { 1138 /** 1139 * @see ParagonIE_Sodium_Compat::crypto_sign_verify_detached() 1140 * @param string $signature 1141 * @param string $message 1142 * @param string $pk 1143 * @return bool 1144 * @throws SodiumException 1145 * @throws TypeError 1146 */ 1147 function sodium_crypto_sign_verify_detached($signature, $message, $pk) 1148 { 1149 return ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $pk); 1150 } 1151 } 1152 if (!is_callable('sodium_crypto_sign_ed25519_pk_to_curve25519')) { 1153 /** 1154 * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519() 1155 * @param string $pk 1156 * @return string 1157 * @throws SodiumException 1158 * @throws TypeError 1159 */ 1160 function sodium_crypto_sign_ed25519_pk_to_curve25519($pk) 1161 { 1162 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($pk); 1163 } 1164 } 1165 if (!is_callable('sodium_crypto_sign_ed25519_sk_to_curve25519')) { 1166 /** 1167 * @see ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519() 1168 * @param string $sk 1169 * @return string 1170 * @throws SodiumException 1171 * @throws TypeError 1172 */ 1173 function sodium_crypto_sign_ed25519_sk_to_curve25519($sk) 1174 { 1175 return ParagonIE_Sodium_Compat::crypto_sign_ed25519_sk_to_curve25519($sk); 1176 } 1177 } 1178 if (!is_callable('sodium_crypto_stream')) { 1179 /** 1180 * @see ParagonIE_Sodium_Compat::crypto_stream() 1181 * @param int $len 1182 * @param string $nonce 1183 * @param string $key 1184 * @return string 1185 * @throws SodiumException 1186 * @throws TypeError 1187 */ 1188 function sodium_crypto_stream($len, $nonce, $key) 1189 { 1190 return ParagonIE_Sodium_Compat::crypto_stream($len, $nonce, $key); 1191 } 1192 } 1193 if (!is_callable('sodium_crypto_stream_keygen')) { 1194 /** 1195 * @see ParagonIE_Sodium_Compat::crypto_stream_keygen() 1196 * @return string 1197 * @throws Exception 1198 */ 1199 function sodium_crypto_stream_keygen() 1200 { 1201 return ParagonIE_Sodium_Compat::crypto_stream_keygen(); 1202 } 1203 } 1204 if (!is_callable('sodium_crypto_stream_xor')) { 1205 /** 1206 * @see ParagonIE_Sodium_Compat::crypto_stream_xor() 1207 * @param string $message 1208 * @param string $nonce 1209 * @param string $key 1210 * @return string 1211 * @throws SodiumException 1212 * @throws TypeError 1213 */ 1214 function sodium_crypto_stream_xor($message, $nonce, $key) 1215 { 1216 return ParagonIE_Sodium_Compat::crypto_stream_xor($message, $nonce, $key); 1217 } 1218 } 1219 if (!is_callable('sodium_hex2bin')) { 1220 /** 1221 * @see ParagonIE_Sodium_Compat::hex2bin() 1222 * @param string $string 1223 * @return string 1224 * @throws SodiumException 1225 * @throws TypeError 1226 */ 1227 function sodium_hex2bin($string) 1228 { 1229 return ParagonIE_Sodium_Compat::hex2bin($string); 1230 } 1231 } 1232 if (!is_callable('sodium_increment')) { 1233 /** 1234 * @see ParagonIE_Sodium_Compat::increment() 1235 * @param string $string 1236 * @return void 1237 * @throws SodiumException 1238 * @throws TypeError 1239 */ 1240 function sodium_increment(&$string) 1241 { 1242 ParagonIE_Sodium_Compat::increment($string); 1243 } 1244 } 1245 if (!is_callable('sodium_library_version_major')) { 1246 /** 1247 * @see ParagonIE_Sodium_Compat::library_version_major() 1248 * @return int 1249 */ 1250 function sodium_library_version_major() 1251 { 1252 return ParagonIE_Sodium_Compat::library_version_major(); 1253 } 1254 } 1255 if (!is_callable('sodium_library_version_minor')) { 1256 /** 1257 * @see ParagonIE_Sodium_Compat::library_version_minor() 1258 * @return int 1259 */ 1260 function sodium_library_version_minor() 1261 { 1262 return ParagonIE_Sodium_Compat::library_version_minor(); 1263 } 1264 } 1265 if (!is_callable('sodium_version_string')) { 1266 /** 1267 * @see ParagonIE_Sodium_Compat::version_string() 1268 * @return string 1269 */ 1270 function sodium_version_string() 1271 { 1272 return ParagonIE_Sodium_Compat::version_string(); 1273 } 1274 } 1275 if (!is_callable('sodium_memcmp')) { 1276 /** 1277 * @see ParagonIE_Sodium_Compat::memcmp() 1278 * @param string $a 1279 * @param string $b 1280 * @return int 1281 * @throws SodiumException 1282 * @throws TypeError 1283 */ 1284 function sodium_memcmp($a, $b) 1285 { 1286 return ParagonIE_Sodium_Compat::memcmp($a, $b); 1287 } 1288 } 1289 if (!is_callable('sodium_memzero')) { 1290 /** 1291 * @see ParagonIE_Sodium_Compat::memzero() 1292 * @param string $str 1293 * @return void 1294 * @throws SodiumException 1295 * @throws TypeError 1296 */ 1297 function sodium_memzero(&$str) 1298 { 1299 ParagonIE_Sodium_Compat::memzero($str); 1300 } 1301 } 1302 if (!is_callable('sodium_pad')) { 1303 /** 1304 * @see ParagonIE_Sodium_Compat::pad() 1305 * @param string $unpadded 1306 * @param int $blockSize 1307 * @return int 1308 * @throws SodiumException 1309 * @throws TypeError 1310 */ 1311 function sodium_pad($unpadded, $blockSize) 1312 { 1313 return ParagonIE_Sodium_Compat::pad($unpadded, $blockSize, true); 1314 } 1315 } 1316 if (!is_callable('sodium_unpad')) { 1317 /** 1318 * @see ParagonIE_Sodium_Compat::pad() 1319 * @param string $padded 1320 * @param int $blockSize 1321 * @return int 1322 * @throws SodiumException 1323 * @throws TypeError 1324 */ 1325 function sodium_unpad($padded, $blockSize) 1326 { 1327 return ParagonIE_Sodium_Compat::unpad($padded, $blockSize, true); 1328 } 1329 } 1330 if (!is_callable('sodium_randombytes_buf')) { 1331 /** 1332 * @see ParagonIE_Sodium_Compat::randombytes_buf() 1333 * @param int $amount 1334 * @return string 1335 * @throws Exception 1336 */ 1337 function sodium_randombytes_buf($amount) 1338 { 1339 return ParagonIE_Sodium_Compat::randombytes_buf($amount); 1340 } 1341 } 1342 1343 if (!is_callable('sodium_randombytes_uniform')) { 1344 /** 1345 * @see ParagonIE_Sodium_Compat::randombytes_uniform() 1346 * @param int $upperLimit 1347 * @return int 1348 * @throws Exception 1349 */ 1350 function sodium_randombytes_uniform($upperLimit) 1351 { 1352 return ParagonIE_Sodium_Compat::randombytes_uniform($upperLimit); 1353 } 1354 } 1355 1356 if (!is_callable('sodium_randombytes_random16')) { 1357 /** 1358 * @see ParagonIE_Sodium_Compat::randombytes_random16() 1359 * @return int 1360 * @throws Exception 1361 */ 1362 function sodium_randombytes_random16() 1363 { 1364 return ParagonIE_Sodium_Compat::randombytes_random16(); 1365 } 1366 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Mar 4 01:00:04 2021 | Cross-referenced by PHPXref 0.7.1 |