CoreFiles by mySites.guru
Randval.php37 lines, 953 bytes, from Joomla_5.2.0-Stable-Full_Package.zip
Raw History Compare with 5.1.4
md5
f622e428aff1991844b929b85fd418c2
sha1
01d094b8db8b5a3b3da9f485eb36804a8b428215
sha256
59aa2a2eb4a50d801bf0f5fd246368dadf6575a009a6297627902c7cc9049064
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Encrypt;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Generates cryptographically-secure random values.
 *
 * @since    4.0.0
 */
class Randval implements RandValInterface
{
    /**
     * Returns a cryptographically secure random value.
     *
     * This method allows us to quickly address any future issues if we ever find problems with PHP's random_bytes() on
     * some weird host (you can't be too careful when releasing mass-distributed software).
     *
     * @param   integer  $bytes  How many bytes to return
     *
     * @return  string
     */
    public function generate($bytes = 32)
    {
        return random_bytes($bytes);
    }
}

The same content is in 155 releases, Joomla 5.0.0-alpha1 to 6.2.1-rc1. See them all, or every version of this file.