Cheetah
RandomBytesPseudoRandomStringGenerator.php
Go to the documentation of this file.
1 <?php
25 
27 
29 {
30  use PseudoRandomStringGeneratorTrait;
31 
35  const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from random_bytes(). ';
36 
40  public function __construct()
41  {
42  if (!function_exists('random_bytes')) {
43  throw new FacebookSDKException(
44  static::ERROR_MESSAGE .
45  'The function random_bytes() does not exist.'
46  );
47  }
48  }
49 
53  public function getPseudoRandomString($length)
54  {
55  $this->validateLength($length);
56 
57  return $this->binToHex(random_bytes($length), $length);
58  }
59 }
Facebook\Exceptions\FacebookSDKException
Definition: FacebookSDKException.php:32
Facebook\PseudoRandomString\RandomBytesPseudoRandomStringGenerator\getPseudoRandomString
getPseudoRandomString($length)
Definition: RandomBytesPseudoRandomStringGenerator.php:53
use
GNU LESSER GENERAL PUBLIC LICENSE February Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license but changing it is not allowed[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it By the GNU General Public Licenses are intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This the Lesser General Public applies to some specially designated software packages typically libraries of the Free Software Foundation and other authors who decide to use it You can use it but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular based on the explanations below When we speak of free we are referring to freedom of use
Definition: license.txt:27
php
Facebook\PseudoRandomString\RandomBytesPseudoRandomStringGenerator\__construct
__construct()
Definition: RandomBytesPseudoRandomStringGenerator.php:40
Facebook\PseudoRandomString\RandomBytesPseudoRandomStringGenerator
Definition: RandomBytesPseudoRandomStringGenerator.php:29
Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface
Definition: PseudoRandomStringGeneratorInterface.php:32
Facebook\PseudoRandomString
Definition: McryptPseudoRandomStringGenerator.php:24
Facebook\PseudoRandomString\RandomBytesPseudoRandomStringGenerator\ERROR_MESSAGE
const ERROR_MESSAGE
Definition: RandomBytesPseudoRandomStringGenerator.php:35