[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/ramsey/uuid/src/Generator/ -> SodiumRandomGenerator.php (source)

   1  <?php
   2  /**
   3   * This file is part of the ramsey/uuid library
   4   *
   5   * For the full copyright and license information, please view the LICENSE
   6   * file that was distributed with this source code.
   7   *
   8   * @copyright Copyright (c) Ben Ramsey <[email protected]>
   9   * @license http://opensource.org/licenses/MIT MIT
  10   * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
  11   * @link https://packagist.org/packages/ramsey/uuid Packagist
  12   * @link https://github.com/ramsey/uuid GitHub
  13   */
  14  
  15  namespace Ramsey\Uuid\Generator;
  16  
  17  /**
  18   * SodiumRandomGenerator provides functionality to generate strings of random
  19   * binary data using the PECL libsodium extension
  20   *
  21   * @deprecated As of PHP 7.2.0, the libsodium extension is bundled with PHP, and
  22   *     the random_bytes() PHP function is now the recommended method for
  23   *     generating random byes. The default RandomBytesGenerator uses the
  24   *     random_bytes() function.
  25   *     <em>This generator will be removed in ramsey/uuid 4.0.0.</em>
  26   * @link http://pecl.php.net/package/libsodium
  27   * @link https://paragonie.com/book/pecl-libsodium
  28   */
  29  class SodiumRandomGenerator implements RandomGeneratorInterface
  30  {
  31      /**
  32       * Generates a string of random binary data of the specified length
  33       *
  34       * @param integer $length The number of bytes of random binary data to generate
  35       * @return string A binary string
  36       */
  37      public function generate($length)
  38      {
  39          return \Sodium\randombytes_buf($length);
  40      }
  41  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer