コード例 #1
0
 /**
  * Requires GnuPG, system() function and the installation path to be in the env PATH.
  *
  * Returns an empty string upon failure.
  *
  * @param int $length
  * @return binary
  */
 private static function generateUsingGnuPg($length)
 {
     $random = Executor::shell_exec('gpg --gen-random 0', $length);
     // Set the previously used generator.
     self::$generatorUsed = self::GENERATOR_GNUPG;
     // The value of $random could be null, our casting makes it an empty string.
     return (string) $random;
 }