for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the MesCryptoBundle package.
*
* (c) Francesco Cartenì <http://www.multimediaexperiencestudio.it/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mes\Security\CryptoBundle\Utils;
/**
* Class SecretGenerator.
class SecretGenerator
{
* Generates a random secret.
* @return string The randomly generated secret
public function generateRandomSecret()
if (function_exists('openssl_random_pseudo_bytes')) {
return hash('sha1', openssl_random_pseudo_bytes(23));
}
return hash('sha1', uniqid(mt_rand(), true));