[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
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 use RandomLib\Generator; 18 use RandomLib\Factory; 19 20 /** 21 * RandomLibAdapter provides functionality to generate strings of random 22 * binary data using the paragonie/random-lib library 23 * 24 * @link https://packagist.org/packages/paragonie/random-lib 25 */ 26 class RandomLibAdapter implements RandomGeneratorInterface 27 { 28 /** 29 * @var Generator 30 */ 31 private $generator; 32 33 /** 34 * Constructs a `RandomLibAdapter` using a `RandomLib\Generator` 35 * 36 * By default, if no `Generator` is passed in, this creates a high-strength 37 * generator to use when generating random binary data. 38 * 39 * @param Generator $generator An paragonie/random-lib `Generator` 40 */ 41 public function __construct(Generator $generator = null) 42 { 43 $this->generator = $generator; 44 45 if ($this->generator === null) { 46 $factory = new Factory(); 47 48 $this->generator = $factory->getHighStrengthGenerator(); 49 } 50 } 51 52 /** 53 * Generates a string of random binary data of the specified length 54 * 55 * @param integer $length The number of bytes of random binary data to generate 56 * @return string A binary string 57 */ 58 public function generate($length) 59 { 60 return $this->generator->generate($length); 61 } 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |