I am trying to create 200 characters salt manually and using it with md5 as an parameter to protect passwords with one of my SLIM3 web-app project with
string hash ( string $algo , string $data [, bool $raw_output = FALSE ] )
I want the salt to create randomly each time to make it more secure. What is the best way to do it in PHP5.3?
You can use custom function, that generating salt whith specified length:
function generator($length) {
$sym = array(0,1,2,3,4,5,6,7,8,9,'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m');
$sole = '';
for ($i=1; $i <= $length; $i++) {
$sole .= $sym[rand(0, count($sym) - 1)];
}
return $sole;
}