For those who might want to use it for the same case, such as mine:
I just wrote a simple SecretGenerator:
echo generateSecret(10);
function generateSecret($length) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&!^§\$ß";
$key = "";
for($i = 0; $i <= $length; $i++){
$key .= $chars[mt_rand(0, strlen($chars)-1)];
}
return $key;
}
Will return something like this: "6qß ^ 0UoH7NP"
Of course, this is not a protected function, but it is quite normal to use it to generate simple hashes.
source
share