Skip to content

Instantly share code, notes, and snippets.

@erikfig
Created May 2, 2014 13:26
Show Gist options
  • Save erikfig/d03e29c1ee60ffe1506a to your computer and use it in GitHub Desktop.
Save erikfig/d03e29c1ee60ffe1506a to your computer and use it in GitHub Desktop.
CakePHP Hashs Generator (Security.salt e Security.cipherSeed) - Gerador de Hashs (Security.salt e Security.cipherSeed) para CakePHP
<html>
<head>
<title>CakePHP Gerador de Hash</title>
</head>
<body>
<h1>Gerador de Hash Para CakePHP</h1>
<p>Recarregue a p&aacute;gina para gerar novos hashs!</p>
<?php
function geraSenha($tamanho = 15, $minusculas = true, $maiusculas = true, $numeros = true, $simbolos = true)
{
$lmin = 'abcdefghijkmnopqrstuvwxyz';
$lmai = 'ABCDEFGHIJKLMNPQRSTUVWXYZ';
$num = '234567892345678923456789';
$simb = '!@#$%*-!@#$%*-!@#$%*-';
$retorno = '';
$caracteres = '';
if ($minusculas) $caracteres .= $lmin;
if ($maiusculas) $caracteres .= $lmai;
if ($numeros) $caracteres .= $num;
if ($simbolos) $caracteres .= $simb;
$len = strlen($caracteres);
for ($n = 1; $n <= $tamanho; $n++) {
$rand = mt_rand(1, $len);
$retorno .= $caracteres[$rand-1];
}
return $retorno;
}
echo '<h3>Security.salt</h3>';
echo '<p>'.geraSenha(41,true,true,true,false).'</p>';
echo '<h3>Security.cipherSeed</h3>';
echo '<p>'.geraSenha(29,false,false,true,false).'</p>';
?>
</body>
</html>
@ronaldaraujo
Copy link

Muito bom!

@gomes2191
Copy link

Vlw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment