src/Common/Internal/Utilities.php
public static function generateCryptoKey($length)
    {
        // PHP>=7.0
        if (function_exists('random_bytes')) {
            return random_bytes($length);
        }
        
        $buf = openssl_random_pseudo_bytes($length, $secure);

        if ($buf !== false) {
            return $buf;
        }

        throw new \Exception('PRNG failure');
    }
public static function generateCryptoKey($length)
    {
        // PHP>=7.0
        if (function_exists('random_bytes')) {
            return random_bytes($length);
        }
        
        $buf = openssl_random_pseudo_bytes($length, $secure);

        if ($buf !== false) {
            return $buf;
        }

        throw new \Exception('PRNG failure');
    }
public static function generateCryptoKey ( $ length ) { // PHP>=7.0 if ( function_exists ( 'random_bytes' ) ) { return random_bytes ( $ length ) ; } $ buf = openssl_random_pseudo_bytes ( $ length , $ secure ) ; if ( $ buf !== false ) { return $ buf ; } throw new \ Exception ( 'PRNG failure' ) ; }
Generate a pseudo-random string of bytes using a cryptographically strong
algorithm.

@param int $length Length of the string in bytes

@return string|bool Generated string of bytes on success, or FALSE on
failure
Generate a pseudo - random string of bytes using a cryptographically strong algorithm .