[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/sodium_compat/lib/ -> php72compat.php (source)

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


Generated: Thu Apr 9 01:00:03 2020 Cross-referenced by PHPXref 0.7.1